From 41b21c81a02dc0a00177b53c51232747b7117388 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 12 Sep 2019 08:42:19 -0400 Subject: [PATCH] Fixed mass driver deadlock --- .../anuke/mindustry/ui/fragments/LoadingFragment.java | 2 +- .../world/blocks/distribution/MassDriver.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/io/anuke/mindustry/ui/fragments/LoadingFragment.java b/core/src/io/anuke/mindustry/ui/fragments/LoadingFragment.java index e8ac526a72..da59f5624a 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/LoadingFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/LoadingFragment.java @@ -20,7 +20,7 @@ public class LoadingFragment extends Fragment{ parent.fill(Styles.black8, t -> { t.visible(false); t.touchable(Touchable.enabled); - t.add().height(70f).row(); + t.add().height(133f).row(); t.addImage().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent); t.row(); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java index 461f294c8f..cd579d61eb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java @@ -82,8 +82,8 @@ public class MassDriver extends Block{ //switch states if(entity.state == DriverState.idle){ - //start accepting when idle - if(!entity.waitingShooters.isEmpty()){ + //start accepting when idle and there's space + if(!entity.waitingShooters.isEmpty() && (itemCapacity - entity.items.total() >= minDistribute)){ entity.state = DriverState.accepting; }else if(hasLink){ //switch to shooting if there's a valid link. entity.state = DriverState.shooting; @@ -101,8 +101,8 @@ public class MassDriver extends Block{ } if(entity.state == DriverState.accepting){ - //if there's nothing shooting at this, bail - if(entity.currentShooter() == null){ + //if there's nothing shooting at this, bail - OR, items full + if(entity.currentShooter() == null || (itemCapacity - entity.items.total() < minDistribute)){ entity.state = DriverState.idle; return; } @@ -111,7 +111,7 @@ public class MassDriver extends Block{ entity.rotation = Mathf.slerpDelta(entity.rotation, tile.angleTo(entity.currentShooter()), rotateSpeed * entity.power.satisfaction); }else if(entity.state == DriverState.shooting){ //if there's nothing to shoot at OR someone wants to shoot at this thing, bail - if(!hasLink || !entity.waitingShooters.isEmpty()){ + if(!hasLink || (!entity.waitingShooters.isEmpty() && (itemCapacity - entity.items.total() >= minDistribute))){ entity.state = DriverState.idle; return; }