mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-04-15 10:10:54 -07:00
Wrap upstream tile thingie
This commit is contained in:
parent
b89078733e
commit
656c37372d
1 changed files with 9 additions and 6 deletions
|
|
@ -26,6 +26,8 @@ import static mindustry.Vars.*;
|
|||
public class CraterConveyor extends Block implements Autotiler{
|
||||
private TextureRegion[] regions = new TextureRegion[8];
|
||||
|
||||
protected final Array<Tile> upstreamTiles = new Array<>();
|
||||
|
||||
public float speed = 0f;
|
||||
|
||||
public CraterConveyor(String name){
|
||||
|
|
@ -138,14 +140,9 @@ public class CraterConveyor extends Block implements Autotiler{
|
|||
CraterConveyorEntity entity = tile.ent();
|
||||
int[] bits = buildBlending(tile, tile.rotation(), null, true);
|
||||
|
||||
final boolean[] upstream = {false};
|
||||
upstream(tile, t -> {
|
||||
if(t.block() instanceof CraterConveyor) upstream[0] = true;
|
||||
});
|
||||
|
||||
entity.blendbit2 = 0;
|
||||
if(bits[0] == 0 && blends(tile, tile.rotation(), 0) && !blends(tile, tile.rotation(), 2)) entity.blendbit2 = 5; // a 0 that faces into a crater conveyor with none behind it
|
||||
if(upstream[0] && !blends(tile, tile.rotation(), 0)) entity.blendbit2 = 6; // a 0 that faces into none with a crater conveyor behind it
|
||||
if(!upstream(tile, upstreamTiles).isEmpty() && !blends(tile, tile.rotation(), 0)) entity.blendbit2 = 6; // a 0 that faces into none with a crater conveyor behind it
|
||||
|
||||
entity.blendbit1 = bits[0];
|
||||
entity.blendsclx = bits[1];
|
||||
|
|
@ -303,6 +300,12 @@ public class CraterConveyor extends Block implements Autotiler{
|
|||
) cons.get(tile.left());
|
||||
}
|
||||
|
||||
private Array<Tile> upstream(Tile tile, Array<Tile> upstreamTiles){
|
||||
upstreamTiles.clear();
|
||||
upstream(tile, upstreamTiles::add);
|
||||
return upstreamTiles;
|
||||
}
|
||||
|
||||
// ▲ | ▼ fixme: refactor
|
||||
|
||||
// awaken inputting conveyors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue