mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Fixed mass driver deadlock
This commit is contained in:
parent
44842d3221
commit
41b21c81a0
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user