Fixed units not resetting to their default command
This commit is contained in:
@@ -43,7 +43,7 @@ public class CommandAI extends AIController{
|
|||||||
/** Stance, usually related to firing mode. */
|
/** Stance, usually related to firing mode. */
|
||||||
public UnitStance stance = UnitStance.shoot;
|
public UnitStance stance = UnitStance.shoot;
|
||||||
/** Current command this unit is following. */
|
/** Current command this unit is following. */
|
||||||
public UnitCommand command = UnitCommand.moveCommand;
|
public UnitCommand command;
|
||||||
/** Current controller instance based on command. */
|
/** Current controller instance based on command. */
|
||||||
protected @Nullable AIController commandController;
|
protected @Nullable AIController commandController;
|
||||||
/** Last command type assigned. Used for detecting command changes. */
|
/** Last command type assigned. Used for detecting command changes. */
|
||||||
@@ -63,6 +63,14 @@ public class CommandAI extends AIController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
if(command == null){
|
||||||
|
command = unit.type.defaultCommand == null && unit.type.commands.size > 0 ? unit.type.commands.first() : unit.type.defaultCommand;
|
||||||
|
if(command == null) command = UnitCommand.moveCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLogicControllable(){
|
public boolean isLogicControllable(){
|
||||||
return !hasCommand();
|
return !hasCommand();
|
||||||
|
|||||||
Reference in New Issue
Block a user