Basic unit boost command support
This commit is contained in:
@@ -231,10 +231,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
if(unit != null && unit.team == player.team() && unit.controller() instanceof CommandAI ai){
|
||||
|
||||
//implicitly order it to move
|
||||
ai.command(UnitCommand.moveCommand);
|
||||
if(ai.command == null || ai.command.switchToMove){
|
||||
ai.command(UnitCommand.moveCommand);
|
||||
}
|
||||
|
||||
if(teamTarget != null && teamTarget.team() != player.team()){
|
||||
ai.commandTarget(teamTarget);
|
||||
|
||||
}else if(posTarget != null){
|
||||
ai.commandPosition(posTarget);
|
||||
}
|
||||
@@ -269,10 +272,12 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
for(int id : unitIds){
|
||||
Unit unit = Groups.unit.getByID(id);
|
||||
if(unit != null && unit.team == player.team() && unit.controller() instanceof CommandAI ai){
|
||||
boolean reset = command.resetTarget || ai.currentCommand().resetTarget;
|
||||
ai.command(command);
|
||||
//reset targeting
|
||||
ai.targetPos = null;
|
||||
ai.attackTarget = null;
|
||||
if(reset){
|
||||
ai.targetPos = null;
|
||||
ai.attackTarget = null;
|
||||
}
|
||||
unit.lastCommanded = player.coloredName();
|
||||
}
|
||||
}
|
||||
@@ -868,7 +873,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
for(Unit unit : selectedUnits){
|
||||
CommandAI ai = unit.command();
|
||||
//draw target line
|
||||
if(ai.targetPos != null && ai.command == UnitCommand.moveCommand){
|
||||
if(ai.targetPos != null && ai.currentCommand().drawTarget){
|
||||
Position lineDest = ai.attackTarget != null ? ai.attackTarget : ai.targetPos;
|
||||
Drawf.limitLine(unit, lineDest, unit.hitSize / 2f, 3.5f);
|
||||
|
||||
@@ -880,7 +885,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
Drawf.square(unit.x, unit.y, unit.hitSize / 1.4f + 1f);
|
||||
|
||||
//TODO when to draw, when to not?
|
||||
if(ai.attackTarget != null && ai.command == UnitCommand.moveCommand){
|
||||
if(ai.attackTarget != null && ai.currentCommand().drawTarget){
|
||||
Drawf.target(ai.attackTarget.getX(), ai.attackTarget.getY(), 6f, Pal.remove);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user