mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-27 08:00:04 +07:00
Move launch checks
This commit is contained in:
parent
7b0456a227
commit
f94c7e6105
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user