diff --git a/core/src/io/anuke/mindustry/content/Bullets.java b/core/src/io/anuke/mindustry/content/Bullets.java index 0edd7aca6c..d0aabe945b 100644 --- a/core/src/io/anuke/mindustry/content/Bullets.java +++ b/core/src/io/anuke/mindustry/content/Bullets.java @@ -360,6 +360,7 @@ public class Bullets implements ContentList{ { shootEffect = Fx.shootHeal; + smokeEffect = Fx.hitLaser; hitEffect = Fx.hitLaser; despawnEffect = Fx.hitLaser; collidesTeam = true; diff --git a/core/src/io/anuke/mindustry/content/Fx.java b/core/src/io/anuke/mindustry/content/Fx.java index dece137ea4..d99024d745 100644 --- a/core/src/io/anuke/mindustry/content/Fx.java +++ b/core/src/io/anuke/mindustry/content/Fx.java @@ -162,7 +162,7 @@ public class Fx implements ContentList{ heal = new Effect(11, e -> { Draw.color(Pal.heal); Lines.stroke(e.fout() * 2f); - Lines.poly(e.x, e.y, 10, 2f + e.finpow() * 7f); + Lines.poly(e.x, e.y, 24, 2f + e.finpow() * 7f); Draw.color(); }); diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java index 45da7f1586..6d2b6d8632 100644 --- a/core/src/io/anuke/mindustry/core/NetClient.java +++ b/core/src/io/anuke/mindustry/core/NetClient.java @@ -98,16 +98,15 @@ public class NetClient implements ApplicationListener{ }); Net.handleClient(Disconnect.class, packet -> { + state.set(State.menu); + connecting = false; + Platform.instance.updateRPC(); + if(quiet) return; Time.runTask(3f, ui.loadfrag::hide); - state.set(State.menu); - ui.showError("$disconnect"); - connecting = false; - - Platform.instance.updateRPC(); }); Net.handleClient(WorldStream.class, data -> { diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index fceb8136af..8c70a164ae 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -233,6 +233,12 @@ public class NetServer implements ApplicationListener{ } public static void onDisconnect(Player player){ + //singleplayer multiplayer wierdness + if(player.con == null){ + player.remove(); + return; + } + if(player.con.hasConnected){ Call.sendMessage("[accent]" + player.name + "[accent] has disconnected."); Call.onPlayerDisconnect(player.id); @@ -573,7 +579,7 @@ public class NetServer implements ApplicationListener{ NetConnection connection = player.con; - if(!connection.isConnected() || !connections.containsKey(connection.id)){ + if(connection == null || !connection.isConnected() || !connections.containsKey(connection.id)){ //player disconnected, call d/c event onDisconnect(player); return; diff --git a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java index 7d62c05d16..552fd2d438 100644 --- a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java @@ -337,6 +337,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ public void write(DataOutput data) throws IOException{ super.writeSave(data); data.writeByte(type.id); + data.writeInt(spawner); } @Override @@ -344,6 +345,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ float lastx = x, lasty = y, lastrot = rotation; super.readSave(data); this.type = content.getByID(ContentType.unit, data.readByte()); + this.spawner = data.readInt(); interpolator.read(lastx, lasty, x, y, rotation); rotation = lastrot; diff --git a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java index d831e44595..2d75666b01 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java @@ -35,6 +35,7 @@ import java.io.DataOutput; import java.io.IOException; public class UnitFactory extends Block{ + //for attack mode protected float gracePeriodMultiplier = 15f; protected float speedupTime = 60f * 60f * 20; protected float maxSpeedup = 2f; @@ -57,14 +58,14 @@ public class UnitFactory extends Block{ } @Remote(called = Loc.server) - public static void onUnitFactorySpawn(Tile tile){ + public static void onUnitFactorySpawn(Tile tile, int spawns){ if(!(tile.entity instanceof UnitFactoryEntity) || !(tile.block() instanceof UnitFactory)) return; UnitFactoryEntity entity = tile.entity(); UnitFactory factory = (UnitFactory) tile.block(); entity.buildTime = 0f; - entity.spawned ++; + entity.spawned = spawns; Effects.shake(2f, 3f, entity); Effects.effect(Fx.producesmoke, tile.drawx(), tile.drawy()); @@ -182,7 +183,7 @@ public class UnitFactory extends Block{ if(entity.buildTime >= produceTime){ entity.buildTime = 0f; - Call.onUnitFactorySpawn(tile); + Call.onUnitFactorySpawn(tile, entity.spawned + 1); useContent(tile, type); for(ItemStack stack : consumes.items()){