Basic unit boost command support

This commit is contained in:
Anuken
2023-02-11 17:40:57 -05:00
parent 946e36c66e
commit ec8262418f
9 changed files with 81 additions and 21 deletions

View File

@@ -14,7 +14,10 @@ public class UnitCommand{
public static final UnitCommand
moveCommand = new UnitCommand("move", "right", u -> null),
moveCommand = new UnitCommand("move", "right", u -> null){{
drawTarget = true;
resetTarget = false;
}},
repairCommand = new UnitCommand("repair", "modeSurvival", u -> new RepairAI()),
rebuildCommand = new UnitCommand("rebuild", "hammer", u -> new BuilderAI()),
assistCommand = new UnitCommand("assist", "players", u -> {
@@ -22,7 +25,12 @@ public class UnitCommand{
ai.onlyAssist = true;
return ai;
}),
mineCommand = new UnitCommand("mine", "production", u -> new MinerAI());
mineCommand = new UnitCommand("mine", "production", u -> new MinerAI()),
boostCommand = new UnitCommand("boost", "up", u -> new BoostAI()){{
switchToMove = false;
drawTarget = true;
resetTarget = false;
}};
/** Unique ID number. */
public final int id;
@@ -32,6 +40,12 @@ public class UnitCommand{
public final String icon;
/** Controller that this unit will use when this command is used. Return null for "default" behavior. */
public final Func<Unit, AIController> controller;
/** If true, this unit will automatically switch away to the move command when given a position. */
public boolean switchToMove = true;
/** Whether to draw the movement/attack target. */
public boolean drawTarget = false;
/** Whether to reset targets when switching to or from this command. */
public boolean resetTarget = true;
public UnitCommand(String name, String icon, Func<Unit, AIController> controller){
this.name = name;