This commit is contained in:
Anuken 2022-11-13 09:57:09 -05:00
parent 80046ba505
commit b422e041f4
2 changed files with 9 additions and 6 deletions

View file

@ -282,17 +282,17 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public static void commandBuilding(Player player, int[] buildings, Vec2 target){
if(player == null || target == null) return;
if(net.server() && !netServer.admins.allowAction(player, ActionType.commandBuilding, event -> {
event.buildingPositions = buildings;
})){
throw new ValidateException(player, "Player cannot command buildings.");
}
for(int pos : buildings){
var build = world.build(pos);
if(build == null || build.team() != player.team() || !build.block.commandable) continue;
if(net.server() && !netServer.admins.allowAction(player, ActionType.commandBuilding, event -> {
event.tile = build.tile;
})){
throw new ValidateException(player, "Player cannot command building.");
}
build.onCommand(target);
if(!state.isPaused() && player == Vars.player){
Fx.moveCommand.at(target);

View file

@ -650,6 +650,9 @@ public class Administration{
/** valid only for command unit events */
public @Nullable int[] unitIDs;
/** valid only for command building events */
public @Nullable int[] buildingPositions;
public PlayerAction set(Player player, ActionType type, Tile tile){
this.player = player;
this.type = type;