Move capping code from armored to normal conduits (#4979)
This commit is contained in:
committed by
GitHub
parent
b2ed0ee884
commit
232415f1d7
@@ -1,13 +1,10 @@
|
|||||||
package mindustry.world.blocks.liquid;
|
package mindustry.world.blocks.liquid;
|
||||||
|
|
||||||
import arc.graphics.g2d.*;
|
|
||||||
import mindustry.annotations.Annotations.*;
|
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
public class ArmoredConduit extends Conduit{
|
public class ArmoredConduit extends Conduit{
|
||||||
public @Load("@-cap") TextureRegion capRegion;
|
|
||||||
|
|
||||||
public ArmoredConduit(String name){
|
public ArmoredConduit(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -21,17 +18,6 @@ public class ArmoredConduit extends Conduit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ArmoredConduitBuild extends ConduitBuild{
|
public class ArmoredConduitBuild extends ConduitBuild{
|
||||||
@Override
|
|
||||||
public void draw(){
|
|
||||||
super.draw();
|
|
||||||
|
|
||||||
//draw the cap when a conduit would normally leak
|
|
||||||
Building next = front();
|
|
||||||
if(next != null && next.team == team && next.block.hasLiquids) return;
|
|
||||||
|
|
||||||
Draw.rect(capRegion, x, y, rotdeg());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptLiquid(Building source, Liquid liquid){
|
public boolean acceptLiquid(Building source, Liquid liquid){
|
||||||
return super.acceptLiquid(source, liquid) && (source.block instanceof Conduit ||
|
return super.acceptLiquid(source, liquid) && (source.block instanceof Conduit ||
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
|||||||
|
|
||||||
public @Load(value = "@-top-#", length = 5) TextureRegion[] topRegions;
|
public @Load(value = "@-top-#", length = 5) TextureRegion[] topRegions;
|
||||||
public @Load(value = "@-bottom-#", length = 5, fallback = "conduit-bottom-#") TextureRegion[] botRegions;
|
public @Load(value = "@-bottom-#", length = 5, fallback = "conduit-bottom-#") TextureRegion[] botRegions;
|
||||||
|
public @Load("@-cap") TextureRegion capRegion;
|
||||||
|
|
||||||
public boolean leaks = true;
|
public boolean leaks = true;
|
||||||
|
|
||||||
@@ -83,6 +84,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
|||||||
public class ConduitBuild extends LiquidBuild implements ChainedBuilding{
|
public class ConduitBuild extends LiquidBuild implements ChainedBuilding{
|
||||||
public float smoothLiquid;
|
public float smoothLiquid;
|
||||||
public int blendbits, xscl, yscl, blending;
|
public int blendbits, xscl, yscl, blending;
|
||||||
|
public boolean capped;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
@@ -104,6 +106,8 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
|||||||
Draw.scl(xscl, yscl);
|
Draw.scl(xscl, yscl);
|
||||||
drawAt(x, y, blendbits, rotation, SliceMode.none);
|
drawAt(x, y, blendbits, rotation, SliceMode.none);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
|
if(capped && capRegion.found()) Draw.rect(capRegion, x, y, rotdeg());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawAt(float x, float y, int bits, float rotation, SliceMode slice){
|
protected void drawAt(float x, float y, int bits, float rotation, SliceMode slice){
|
||||||
@@ -124,6 +128,9 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
|||||||
xscl = bits[1];
|
xscl = bits[1];
|
||||||
yscl = bits[2];
|
yscl = bits[2];
|
||||||
blending = bits[4];
|
blending = bits[4];
|
||||||
|
|
||||||
|
Building next = front();
|
||||||
|
capped = next == null || next.team != team || !next.block.hasLiquids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user