Fixed mass driver deadlock

This commit is contained in:
Anuken 2019-09-12 08:42:19 -04:00
parent 44842d3221
commit 41b21c81a0
2 changed files with 6 additions and 6 deletions

View File

@ -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();

View File

@ -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;
}