Phase out the need for isSleeping

Thanks to knowledge gained from the previous commit.
This commit is contained in:
Patrick 'Quezler' Mounier 2020-04-16 18:56:00 +02:00
parent b599bafd5e
commit e66a1a92c3
No known key found for this signature in database
GPG Key ID: 0D6CA7326C76D8EA
2 changed files with 19 additions and 22 deletions

View File

@ -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. */
public void noSleep(){
sleepTime = 0f;

View File

@ -224,31 +224,32 @@ public class CraterConveyor extends Block implements Autotiler{
}
// crater conveyor tiles that input into this one
private void upstream(Tilec tile, Cons<Tilec> cons){
CraterConveyorEntity entity = (CraterConveyorEntity)tile;
private void upstream(CraterConveyorEntity tile, Cons<CraterConveyorEntity> cons){
if( entity.blendbit1 == 0 // 1 input from the back, 0 from the sides
|| 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(tile.blendbit1 == 0 && !(back() instanceof CraterConveyorEntity)) return;
if( entity.blendbit1 == 3 // 1 input from the back, 2 from the sides
|| entity.blendbit1 == 4 // 0 input from the back, 2 from the sides
||(entity.blendbit1 == 1 && entity.blendscly == -1) // side is open
||(entity.blendbit1 == 2 && entity.blendscly == +1) // side is open
) cons.get(right());
if( tile.blendbit1 == 0 // 1 input from the back, 0 from the sides
|| tile.blendbit1 == 2 // 1 input from the back, 1 from the sides
|| tile.blendbit1 == 3 // 1 input from the back, 2 from the sides
) cons.get((CraterConveyorEntity)back());
if( entity.blendbit1 == 3 // 1 input from the back, 2 from the sides
|| entity.blendbit1 == 4 // 0 input from the back, 2 from the sides
||(entity.blendbit1 == 1 && entity.blendscly == +1) // side is open
||(entity.blendbit1 == 2 && entity.blendscly == -1) // side is open
) cons.get(left());
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)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
private void bump(Tilec tile){
private void bump(CraterConveyorEntity tile){
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();
bump(t);
});