diff --git a/core/src/mindustry/ai/WaveSpawner.java b/core/src/mindustry/ai/WaveSpawner.java index 9f2039284b..09060fd33d 100644 --- a/core/src/mindustry/ai/WaveSpawner.java +++ b/core/src/mindustry/ai/WaveSpawner.java @@ -5,11 +5,13 @@ import arc.func.*; import arc.math.*; import arc.struct.*; import arc.util.*; +import mindustry.annotations.Annotations.*; import mindustry.content.*; import mindustry.entities.*; import mindustry.game.EventType.*; import mindustry.game.*; import mindustry.gen.*; +import mindustry.type.*; import mindustry.world.*; import static mindustry.Vars.*; @@ -127,14 +129,18 @@ public class WaveSpawner{ } private void spawnEffect(Unit unit){ - Fx.unitSpawn.at(unit.x(), unit.y(), 0f, unit); - Time.run(30f, () -> { - unit.add(); - Fx.spawn.at(unit); - }); + Call.spawnEffect(unit.x, unit.y, unit.type()); + Time.run(30f, unit::add); } private interface SpawnConsumer{ void accept(float x, float y, boolean shockwave); } + + @Remote(called = Loc.server, unreliable = true) + public static void spawnEffect(float x, float y, UnitType type){ + Fx.unitSpawn.at(x, y, 0f, type); + + Time.run(30f, () -> Fx.spawn.at(x, y)); + } } diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index d6bbf8b08f..04723e941d 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -26,15 +26,15 @@ public class Fx{ none = new Effect(0, 0f, e -> {}), unitSpawn = new Effect(30f, e -> { - if(!(e.data instanceof Unit)) return; + if(!(e.data instanceof UnitType)) return; alpha(e.fin()); float scl = 1f + e.fout() * 2f; - Unit unit = e.data(); - rect(unit.type().region, e.x, e.y, - unit.type().region.getWidth() * Draw.scl * scl, unit.type().region.getHeight() * Draw.scl * scl, 180f); + UnitType unit = e.data(); + rect(unit.region, e.x, e.y, + unit.region.getWidth() * Draw.scl * scl, unit.region.getHeight() * Draw.scl * scl, 180f); }), @@ -369,7 +369,7 @@ public class Fx{ hitLiquid = new Effect(16, e -> { color(e.color); - randLenVectors(e.id, 5, e.fin() * 15f, e.rotation + 180f, 60f, (x, y) -> { + randLenVectors(e.id, 5, e.fin() * 15f, e.rotation, 60f, (x, y) -> { Fill.circle(e.x + x, e.y + y, e.fout() * 2f); }); diff --git a/core/src/mindustry/entities/bullet/LiquidBulletType.java b/core/src/mindustry/entities/bullet/LiquidBulletType.java index ed9823fcc3..45ae536668 100644 --- a/core/src/mindustry/entities/bullet/LiquidBulletType.java +++ b/core/src/mindustry/entities/bullet/LiquidBulletType.java @@ -69,7 +69,7 @@ public class LiquidBulletType extends BulletType{ super.despawned(b); //don't create liquids when the projectile despawns - hitEffect.at(b.x, b.y, liquid.color); + hitEffect.at(b.x, b.y, b.rotation(), liquid.color); } @Override diff --git a/server/src/mindustry/server/ServerControl.java b/server/src/mindustry/server/ServerControl.java index 57d456184f..7110342f81 100644 --- a/server/src/mindustry/server/ServerControl.java +++ b/server/src/mindustry/server/ServerControl.java @@ -208,6 +208,10 @@ public class ServerControl implements ApplicationListener{ } }); + //autosave settings once a minute + float saveInterval = 60; + Timer.schedule(() -> Core.settings.forceSave(), saveInterval, saveInterval); + if(!mods.list().isEmpty()){ info("&lc@ mods loaded.", mods.list().size); } @@ -516,6 +520,7 @@ public class ServerControl implements ApplicationListener{ } Log.info("&lc@&lg set to &lc@.", c.name(), c.get()); + Core.settings.forceSave(); } }catch(IllegalArgumentException e){ err("Unknown config: '@'. Run the command with no arguments to get a list of valid configs.", arg[0]);