Fixed reconstructors not assigning default command

This commit is contained in:
Anuken
2024-09-14 14:44:13 -04:00
parent f0027a3eff
commit 56c9e96201
2 changed files with 5 additions and 4 deletions

View File

@@ -458,6 +458,9 @@ public class UnitType extends UnlockableContent implements Senseable{
Unit unit = constructor.get(); Unit unit = constructor.get();
unit.team = team; unit.team = team;
unit.setType(this); unit.setType(this);
if(controller instanceof CommandAI command && defaultCommand != null){
command.command = defaultCommand;
}
unit.ammo = ammoCapacity; //fill up on ammo upon creation unit.ammo = ammoCapacity; //fill up on ammo upon creation
unit.elevation = flying ? 1f : 0; unit.elevation = flying ? 1f : 0;
unit.heal(); unit.heal();

View File

@@ -311,10 +311,8 @@ public class Reconstructor extends UnitBlock{
if(commandPos != null){ if(commandPos != null){
payload.unit.command().commandPosition(commandPos); payload.unit.command().commandPosition(commandPos);
} }
if(command != null){ //this already checks if it is a valid command for the unit type
//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);
payload.unit.command().command(command);
}
} }
progress %= 1f; progress %= 1f;