diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 90ac947c52..9472028766 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -654,7 +654,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } if(player.team() == build.team && build.canControlSelect(player.unit())){ + var before = player.unit(); + build.onControlSelect(player.unit()); + + if(!before.dead && before.spawnedByCore && !before.isPlayer()){ + Call.unitDespawn(before); + } } } @@ -699,6 +705,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ //direct dock transfer??? unit.dockedType = before.dockedType; } + + if(before.spawnedByCore && !before.isPlayer()){ + Call.unitDespawn(before); + } } Time.run(Fx.unitSpirit.lifetime, () -> Fx.unitControl.at(unit.x, unit.y, 0f, unit));