diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index ecf2e5f480..e441943900 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -54,6 +54,21 @@ public class Fx{ reset(); }), + unitDespawn = new Effect(100f, e -> { + if(!(e.data instanceof Unitc)) return; + + Unitc select = (Unitc)e.data; + float scl = e.fout(Interp.pow2Out); + float p = Draw.scl; + Draw.scl *= scl; + + mixcol(Pal.accent, 1f); + rect(select.type().icon(Cicon.full), select.x(), select.y(), select.rotation() - 90f); + reset(); + + Draw.scl = p; + }), + unitSpirit = new Effect(17f, e -> { if(!(e.data instanceof Position)) return; Position to = e.data(); diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 5f5a891dba..181638dc07 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -24,6 +24,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I private transient UnitController controller; private UnitType type; + boolean spawnedByCore; public void moveAt(Vec2 vector){ moveAt(vector, type.accel); @@ -171,6 +172,12 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I } controller.update(); + + //remove units spawned by the core + if(spawnedByCore && !(controller instanceof Playerc)){ + Fx.unitDespawn.at(x, y, 0, this); + remove(); + } } @Override diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 95a7e21982..8ff113972b 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -49,6 +49,7 @@ public class CoreBlock extends StorageBlock{ unit.set(entity); unit.impulse(0f, 8f); unit.controller(player); + unit.spawnedByCore(true); unit.add(); }