Compare commits

...

4 Commits
v144 ... v144.1

Author SHA1 Message Date
Anuken
126cca9e86 Gas sprite revert 2023-05-12 02:05:52 -04:00
MEEPofFaith
688b5b9eea Revert "Properly handle missile units shooting more missile units (#8359)" (#8585)
This reverts commit 1373381554.
2023-05-12 01:58:30 -04:00
WayZer
0496d2108c fix NPE in SpawnGroup.write (#8584)
* Update SpawnGroup.java

* Update contributors

* No Objects.isNull
2023-05-11 22:21:05 -04:00
Anuken
06e63dad45 Fixed #8582 2023-05-11 17:05:18 -04:00
11 changed files with 20 additions and 18 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 322 B

View File

@@ -155,3 +155,4 @@ AyuKo-o
JojoFR1 JojoFR1
Xasmedy Xasmedy
xStaBUx xStaBUx
WayZer

View File

@@ -85,6 +85,14 @@ public class UI implements ApplicationListener, Loadable{
Fonts.loadFonts(); Fonts.loadFonts();
} }
public static void loadColors(){
Colors.put("accent", Pal.accent);
Colors.put("unlaunched", Color.valueOf("8982ed"));
Colors.put("highlight", Pal.accent.cpy().lerp(Color.white, 0.3f));
Colors.put("stat", Pal.stat);
Colors.put("negstat", Pal.negativeStat);
}
@Override @Override
public void loadAsync(){ public void loadAsync(){
@@ -92,6 +100,8 @@ public class UI implements ApplicationListener, Loadable{
@Override @Override
public void loadSync(){ public void loadSync(){
loadColors();
Fonts.outline.getData().markupEnabled = true; Fonts.outline.getData().markupEnabled = true;
Fonts.def.getData().markupEnabled = true; Fonts.def.getData().markupEnabled = true;
Fonts.def.setOwnsTexture(false); Fonts.def.setOwnsTexture(false);
@@ -125,12 +135,6 @@ public class UI implements ApplicationListener, Loadable{
ClickListener.clicked = () -> Sounds.press.play(); ClickListener.clicked = () -> Sounds.press.play();
Colors.put("accent", Pal.accent);
Colors.put("unlaunched", Color.valueOf("8982ed"));
Colors.put("highlight", Pal.accent.cpy().lerp(Color.white, 0.3f));
Colors.put("stat", Pal.stat);
Colors.put("negstat", Pal.negativeStat);
drillCursor = Core.graphics.newCursor("drill", Fonts.cursorScale()); drillCursor = Core.graphics.newCursor("drill", Fonts.cursorScale());
unloadCursor = Core.graphics.newCursor("unload", Fonts.cursorScale()); unloadCursor = Core.graphics.newCursor("unload", Fonts.cursorScale());
targetCursor = Core.graphics.newCursor("target", Fonts.cursorScale()); targetCursor = Core.graphics.newCursor("target", Fonts.cursorScale());

View File

@@ -554,7 +554,7 @@ public class BulletType extends Content implements Cloneable{
public void init(Bullet b){ public void init(Bullet b){
if(killShooter && b.owner() instanceof Healthc h && !h.dead()){ if(killShooter && b.owner() instanceof Healthc h){
h.kill(); h.kill();
} }
@@ -700,6 +700,7 @@ public class BulletType extends Content implements Cloneable{
return create(owner, team, x, y, angle, -1, velocityScl, lifetimeScl, null); return create(owner, team, x, y, angle, -1, velocityScl, lifetimeScl, null);
} }
public @Nullable Bullet create(Entityc owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl, Mover mover){ public @Nullable Bullet create(Entityc owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl, Mover mover){
return create(owner, team, x, y, angle, -1, velocityScl, lifetimeScl, null, mover); return create(owner, team, x, y, angle, -1, velocityScl, lifetimeScl, null, mover);
} }
@@ -731,27 +732,24 @@ public class BulletType extends Content implements Cloneable{
Unit spawned = spawnUnit.create(team); Unit spawned = spawnUnit.create(team);
spawned.set(x, y); spawned.set(x, y);
spawned.rotation = angle; spawned.rotation = angle;
//immediately spawn at top speed, since it was launched //immediately spawn at top speed, since it was launched
if(spawnUnit.missileAccelTime <= 0f){ if(spawnUnit.missileAccelTime <= 0f){
spawned.vel.trns(angle, spawnUnit.speed); spawned.vel.trns(angle, spawnUnit.speed);
} }
//assign unit owner //assign unit owner
if(spawned.controller() instanceof MissileAI ai){ if(spawned.controller() instanceof MissileAI ai){
if(owner instanceof Unit unit){ if(owner instanceof Unit unit){
ai.shooter = unit; ai.shooter = unit;
} }
if(owner instanceof ControlBlock control){ if(owner instanceof ControlBlock control){
ai.shooter = control.unit(); ai.shooter = control.unit();
} }
} }
spawned.add(); spawned.add();
} }
//Since bullet init is never called, handle killing shooter here
if(killShooter && owner instanceof Healthc h && !h.dead()) h.kill();
//no bullet returned //no bullet returned
return null; return null;
} }

View File

@@ -138,7 +138,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
shieldScaling = data.getFloat("shieldScaling", 0); shieldScaling = data.getFloat("shieldScaling", 0);
unitAmount = data.getInt("amount", 1); unitAmount = data.getInt("amount", 1);
spawn = data.getInt("spawn", -1); spawn = data.getInt("spawn", -1);
if(data.has("payloads")) payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(s -> content.unit(s)); if(data.has("payloads")) payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(content::unit).removeAll(t -> t == null);
if(data.has("items")) items = json.readValue(ItemStack.class, data.get("items")); if(data.has("items")) items = json.readValue(ItemStack.class, data.get("items"));

View File

@@ -10,7 +10,6 @@ import arc.math.geom.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.ai.types.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.audio.*; import mindustry.audio.*;
import mindustry.content.*; import mindustry.content.*;
@@ -457,8 +456,7 @@ public class Weapon implements Cloneable{
lifeScl = bullet.scaleLife ? Mathf.clamp(Mathf.dst(bulletX, bulletY, mount.aimX, mount.aimY) / bullet.range) : 1f, lifeScl = bullet.scaleLife ? Mathf.clamp(Mathf.dst(bulletX, bulletY, mount.aimX, mount.aimY) / bullet.range) : 1f,
angle = angleOffset + shootAngle + Mathf.range(inaccuracy + bullet.inaccuracy); angle = angleOffset + shootAngle + Mathf.range(inaccuracy + bullet.inaccuracy);
Entityc shooter = unit.controller() instanceof MissileAI ai ? ai.shooter : unit; //Pass the missile's shooter down to its bullets mount.bullet = bullet.create(unit, unit.team, bulletX, bulletY, angle, -1f, (1f - velocityRnd) + Mathf.random(velocityRnd), lifeScl, null, mover, mount.aimX, mount.aimY);
mount.bullet = bullet.create(shooter, unit.team, bulletX, bulletY, angle, -1f, (1f - velocityRnd) + Mathf.random(velocityRnd), lifeScl, null, mover, mount.aimX, mount.aimY);
handleBullet(unit, mount, mount.bullet); handleBullet(unit, mount, mount.bullet);
if(!continuous){ if(!continuous){

View File

@@ -25,4 +25,4 @@ org.gradle.caching=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
archash=a0bdca954b archash=55585b5c6e

View File

@@ -45,6 +45,7 @@ public class ServerLauncher implements ApplicationListener{
Vars.loadSettings(); Vars.loadSettings();
Vars.init(); Vars.init();
UI.loadColors();
content.createBaseContent(); content.createBaseContent();
mods.loadScripts(); mods.loadScripts();
content.createModContent(); content.createModContent();