mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 06:51:30 -08:00
Fixed #7906
This commit is contained in:
parent
80046ba505
commit
b422e041f4
2 changed files with 9 additions and 6 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue