From 10f2a7b59c3c934e5415a1f34084c30848bad919 Mon Sep 17 00:00:00 2001 From: hortiSquash <45213805+hortiSquash@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:01:05 +0200 Subject: [PATCH] hortiloader hotfix (#6248) Added an offset so they cycle through all buildings having the same load --- core/src/mindustry/world/blocks/storage/Unloader.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/world/blocks/storage/Unloader.java b/core/src/mindustry/world/blocks/storage/Unloader.java index 2b8c4ad4a1..abd4b4a99c 100644 --- a/core/src/mindustry/world/blocks/storage/Unloader.java +++ b/core/src/mindustry/world/blocks/storage/Unloader.java @@ -85,8 +85,9 @@ public class Unloader extends Block{ if(sortItem != null){ item = sortItem; - for(int pos = 0; pos < proximity.size; pos++){ - var other = proximity.get(pos); + for(int j = 0; j < proximity.size; j++){ + int pos = (offset + j) % proximity.size; + var other = proximity.get(j); boolean interactable = other.interactable(team); //set the stats of all buildings in possibleBlocks @@ -105,8 +106,9 @@ public class Unloader extends Block{ boolean isDistinct = false; Item possibleItem = content.item(total); - for(int pos = 0; pos < proximity.size; pos++){ - var other = proximity.get(pos); + for(int j = 0; j < proximity.size; j++){ + int pos = (offset + j) % proximity.size; + var other = proximity.get(j); boolean interactable = other.interactable(team); //set the stats of all buildings in possibleBlocks while we are at it