mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-05 13:08:20 +07:00
Move capping code from armored to normal conduits (#4979)
This commit is contained in:
parent
b2ed0ee884
commit
232415f1d7
@ -1,13 +1,10 @@
|
||||
package mindustry.world.blocks.liquid;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class ArmoredConduit extends Conduit{
|
||||
public @Load("@-cap") TextureRegion capRegion;
|
||||
|
||||
public ArmoredConduit(String name){
|
||||
super(name);
|
||||
@ -21,17 +18,6 @@ public class ArmoredConduit extends Conduit{
|
||||
}
|
||||
|
||||
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
|
||||
public boolean acceptLiquid(Building source, Liquid liquid){
|
||||
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 = "@-bottom-#", length = 5, fallback = "conduit-bottom-#") TextureRegion[] botRegions;
|
||||
public @Load("@-cap") TextureRegion capRegion;
|
||||
|
||||
public boolean leaks = true;
|
||||
|
||||
@ -83,6 +84,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
public class ConduitBuild extends LiquidBuild implements ChainedBuilding{
|
||||
public float smoothLiquid;
|
||||
public int blendbits, xscl, yscl, blending;
|
||||
public boolean capped;
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
@ -104,6 +106,8 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
Draw.scl(xscl, yscl);
|
||||
drawAt(x, y, blendbits, rotation, SliceMode.none);
|
||||
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){
|
||||
@ -124,6 +128,9 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
xscl = bits[1];
|
||||
yscl = bits[2];
|
||||
blending = bits[4];
|
||||
|
||||
Building next = front();
|
||||
capped = next == null || next.team != team || !next.block.hasLiquids;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user