mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-03 03:31:28 +03:00
Duct caps (#12568)
This commit is contained in:
@@ -29,6 +29,7 @@ public class Duct extends Block implements Autotiler{
|
||||
|
||||
public @Load(value = "@-top-#", length = 5) TextureRegion[] topRegions;
|
||||
public @Load(value = "@-bottom-#", length = 5, fallback = "duct-bottom-#") TextureRegion[] botRegions;
|
||||
public @Load("@-cap") TextureRegion capRegion;
|
||||
|
||||
public @Nullable Block bridgeReplacement, junctionReplacement;
|
||||
|
||||
@@ -132,8 +133,9 @@ public class Duct extends Block implements Autotiler{
|
||||
public @Nullable Item current;
|
||||
public int recDir = 0;
|
||||
public int blendbits, xscl, yscl, blending;
|
||||
public @Nullable Building next;
|
||||
public @Nullable Building next, prev;
|
||||
public @Nullable DuctBuild nextc;
|
||||
public boolean capped, backCapped = false;
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
@@ -174,6 +176,11 @@ public class Duct extends Block implements Autotiler{
|
||||
Draw.z(Layer.blockUnder + 0.2f);
|
||||
drawAt(x, y, blendbits, rotation, SliceMode.none, under);
|
||||
Draw.reset();
|
||||
|
||||
if(!under) return;
|
||||
|
||||
if(capped && capRegion.found()) Draw.rect(capRegion, x, y, rotdeg());
|
||||
if(backCapped && capRegion.found()) Draw.rect(capRegion, x, y, rotdeg() + 180);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -254,6 +261,10 @@ public class Duct extends Block implements Autotiler{
|
||||
blending = bits[4];
|
||||
next = front();
|
||||
nextc = next instanceof DuctBuild d ? d : null;
|
||||
|
||||
prev = back();
|
||||
capped = next == null || next.team != team || !next.block.hasItems;
|
||||
backCapped = blendbits == 0 && (prev == null || prev.team != team || !prev.block.hasItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user