mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-12 19:09:34 +07:00
Phase out the need for isSleeping
Thanks to knowledge gained from the previous commit.
This commit is contained in:
parent
b599bafd5e
commit
e66a1a92c3
@ -249,10 +249,6 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSleeping(){
|
|
||||||
return sleeping;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Call when this entity is updating. This wakes it up. */
|
/** Call when this entity is updating. This wakes it up. */
|
||||||
public void noSleep(){
|
public void noSleep(){
|
||||||
sleepTime = 0f;
|
sleepTime = 0f;
|
||||||
|
@ -224,31 +224,32 @@ public class CraterConveyor extends Block implements Autotiler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// crater conveyor tiles that input into this one
|
// crater conveyor tiles that input into this one
|
||||||
private void upstream(Tilec tile, Cons<Tilec> cons){
|
private void upstream(CraterConveyorEntity tile, Cons<CraterConveyorEntity> cons){
|
||||||
CraterConveyorEntity entity = (CraterConveyorEntity)tile;
|
|
||||||
|
|
||||||
if( entity.blendbit1 == 0 // 1 input from the back, 0 from the sides
|
if(tile.blendbit1 == 0 && !(back() instanceof CraterConveyorEntity)) return;
|
||||||
|| entity.blendbit1 == 2 // 1 input from the back, 1 from the sides
|
|
||||||
|| entity.blendbit1 == 3 // 1 input from the back, 2 from the sides
|
|
||||||
) cons.get(back()); // fixme, fires for 0 while nothing behind
|
|
||||||
|
|
||||||
if( entity.blendbit1 == 3 // 1 input from the back, 2 from the sides
|
if( tile.blendbit1 == 0 // 1 input from the back, 0 from the sides
|
||||||
|| entity.blendbit1 == 4 // 0 input from the back, 2 from the sides
|
|| tile.blendbit1 == 2 // 1 input from the back, 1 from the sides
|
||||||
||(entity.blendbit1 == 1 && entity.blendscly == -1) // side is open
|
|| tile.blendbit1 == 3 // 1 input from the back, 2 from the sides
|
||||||
||(entity.blendbit1 == 2 && entity.blendscly == +1) // side is open
|
) cons.get((CraterConveyorEntity)back());
|
||||||
) cons.get(right());
|
|
||||||
|
|
||||||
if( entity.blendbit1 == 3 // 1 input from the back, 2 from the sides
|
if( tile.blendbit1 == 3 // 1 input from the back, 2 from the sides
|
||||||
|| entity.blendbit1 == 4 // 0 input from the back, 2 from the sides
|
|| tile.blendbit1 == 4 // 0 input from the back, 2 from the sides
|
||||||
||(entity.blendbit1 == 1 && entity.blendscly == +1) // side is open
|
||(tile.blendbit1 == 1 && tile.blendscly == -1) // side is open
|
||||||
||(entity.blendbit1 == 2 && entity.blendscly == -1) // side is open
|
||(tile.blendbit1 == 2 && tile.blendscly == +1) // side is open
|
||||||
) cons.get(left());
|
) cons.get((CraterConveyorEntity)right());
|
||||||
|
|
||||||
|
if( tile.blendbit1 == 3 // 1 input from the back, 2 from the sides
|
||||||
|
|| tile.blendbit1 == 4 // 0 input from the back, 2 from the sides
|
||||||
|
||(tile.blendbit1 == 1 && tile.blendscly == +1) // side is open
|
||||||
|
||(tile.blendbit1 == 2 && tile.blendscly == -1) // side is open
|
||||||
|
) cons.get((CraterConveyorEntity)left());
|
||||||
}
|
}
|
||||||
|
|
||||||
// awaken inputting conveyors
|
// awaken inputting conveyors
|
||||||
private void bump(Tilec tile){
|
private void bump(CraterConveyorEntity tile){
|
||||||
upstream(tile, t -> {
|
upstream(tile, t -> {
|
||||||
if(t == null || !t.isSleeping() || t.items().total() <= 0) return;
|
if(t == null || !t.sleeping || t.items().total() <= 0) return;
|
||||||
t.noSleep();
|
t.noSleep();
|
||||||
bump(t);
|
bump(t);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user