From c66abc3f0fe30239085354dceb4d3b3c13d3b410 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 22 Jun 2023 12:10:52 -0400 Subject: [PATCH] Fixed #8742 --- core/src/mindustry/input/InputHandler.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 54e162e35f..e89174319b 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -857,7 +857,16 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ Events.fire(Trigger.unitCommandAttack); } - Call.commandUnits(player, ids, attack instanceof Building b ? b : null, attack instanceof Unit u ? u : null, target); + int maxChunkSize = 200; + + if(ids.length > maxChunkSize){ + for(int i = 0; i < ids.length; i += maxChunkSize){ + int[] data = Arrays.copyOfRange(ids, i, Math.min(i + maxChunkSize, ids.length)); + Call.commandUnits(player, data, attack instanceof Building b ? b : null, attack instanceof Unit u ? u : null, target); + } + }else{ + Call.commandUnits(player, ids, attack instanceof Building b ? b : null, attack instanceof Unit u ? u : null, target); + } } if(commandBuildings.size > 0){