Move launch checks

This commit is contained in:
Patrick 'Quezler' Mounier 2020-01-03 11:23:47 +01:00
parent 7b0456a227
commit f94c7e6105
No known key found for this signature in database
GPG Key ID: 0D6CA7326C76D8EA

View File

@ -84,7 +84,7 @@ public class CraterConveyor extends BaseConveyor{
entity.crater = null;
}else{
if(entity.items.total() >= getMaximumAccepted(tile, entity.crater.i) || !Track.start.check.get(tile)){
if(shouldLaunch(tile)){
Tile destination = tile.front();
if(entity.crater.dst(tile) < 1.25f){
@ -179,6 +179,27 @@ public class CraterConveyor extends BaseConveyor{
return Mathf.round(super.getMaximumAccepted(tile, item) * tile.entity.timeScale);
}
public boolean shouldLaunch(Tile tile){
CraterConveyorEntity entity = tile.ent();
// its not a start tile so it should be moving
if(!Track.start.check.get(tile)) return true;
// its considered full
if(entity.items.total() >= getMaximumAccepted(tile, entity.crater.i)) return true;
// if it has no way of getting additional items
Tile[] inputs = new Tile[]{tile.back(), tile.left(), tile.right()};
boolean headless = true;
for(Tile input : inputs){
if(input != null && input.getTeam() == tile.getTeam() && input.block().outputsItems()) headless = false;
}
if(headless) return true;
// inactive timer tracker?
return false;
}
@Override
public boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ // only connect to compressable blocks
return super.blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock) && otherblock.compressable;