Added unit stances
This commit is contained in:
@@ -473,7 +473,7 @@ public class DesktopInput extends InputHandler{
|
||||
cursorType = ui.targetCursor;
|
||||
}
|
||||
|
||||
if(input.keyTap(Binding.command_queue) && keybinds.get(Binding.command_mode).key.type != KeyType.mouse){
|
||||
if(input.keyTap(Binding.command_queue) && keybinds.get(Binding.command_queue).key.type != KeyType.mouse){
|
||||
commandTap(input.mouseX(), input.mouseY(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +312,29 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||
public static void setUnitStance(Player player, int[] unitIds, UnitStance stance){
|
||||
if(player == null || unitIds == null || stance == null) return;
|
||||
|
||||
if(net.server() && !netServer.admins.allowAction(player, ActionType.commandUnits, event -> {
|
||||
event.unitIDs = unitIds;
|
||||
})){
|
||||
throw new ValidateException(player, "Player cannot command units.");
|
||||
}
|
||||
|
||||
for(int id : unitIds){
|
||||
Unit unit = Groups.unit.getByID(id);
|
||||
if(unit != null && unit.team == player.team() && unit.controller() instanceof CommandAI ai){
|
||||
if(stance == UnitStance.stopStance){ //not a real stance, just cancels orders
|
||||
ai.clearCommands();
|
||||
}else{
|
||||
ai.stance = stance;
|
||||
}
|
||||
unit.lastCommanded = player.coloredName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||
public static void commandBuilding(Player player, int[] buildings, Vec2 target){
|
||||
if(player == null || target == null) return;
|
||||
|
||||
Reference in New Issue
Block a user