diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index af3cd1b562..4466ecd536 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -458,6 +458,9 @@ public class UnitType extends UnlockableContent implements Senseable{ Unit unit = constructor.get(); unit.team = team; unit.setType(this); + if(controller instanceof CommandAI command && defaultCommand != null){ + command.command = defaultCommand; + } unit.ammo = ammoCapacity; //fill up on ammo upon creation unit.elevation = flying ? 1f : 0; unit.heal(); diff --git a/core/src/mindustry/world/blocks/units/Reconstructor.java b/core/src/mindustry/world/blocks/units/Reconstructor.java index 25b6e72226..94b40a96fe 100644 --- a/core/src/mindustry/world/blocks/units/Reconstructor.java +++ b/core/src/mindustry/world/blocks/units/Reconstructor.java @@ -311,10 +311,8 @@ public class Reconstructor extends UnitBlock{ if(commandPos != null){ payload.unit.command().commandPosition(commandPos); } - if(command != null){ - //this already checks if it is a valid command for the unit type - payload.unit.command().command(command); - } + //this already checks if it is a valid command for the unit type + payload.unit.command().command(command == null && payload.unit.type.defaultCommand != null ? payload.unit.type.defaultCommand : command); } progress %= 1f;