Merge pull request #2882 from Quezler/patch-49
Prevent plated conduits from leaking
This commit is contained in:
@@ -507,15 +507,15 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
}
|
||||
}
|
||||
|
||||
public float moveLiquidForward(float leakResistance, Liquid liquid){
|
||||
public float moveLiquidForward(boolean leaks, Liquid liquid){
|
||||
Tile next = tile.getNearby(rotation);
|
||||
|
||||
if(next == null) return 0;
|
||||
|
||||
if(next.build != null){
|
||||
return moveLiquid(next.build, liquid);
|
||||
}else if(leakResistance != 100f && !next.block().solid && !next.block().hasLiquids){
|
||||
float leakAmount = liquids.get(liquid) / leakResistance;
|
||||
}else if(leaks && !next.block().solid && !next.block().hasLiquids){
|
||||
float leakAmount = liquids.get(liquid) / 1.5f;
|
||||
Puddles.deposit(next, tile, liquid, leakAmount);
|
||||
liquids.remove(liquid, leakAmount);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class ArmoredConduit extends Conduit{
|
||||
|
||||
public ArmoredConduit(String name){
|
||||
super(name);
|
||||
leakResistance = 10f;
|
||||
leaks = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,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 float leakResistance = 1.5f;
|
||||
public boolean leaks = true;
|
||||
|
||||
public Conduit(String name){
|
||||
super(name);
|
||||
@@ -131,7 +131,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
smoothLiquid = Mathf.lerpDelta(smoothLiquid, liquids.currentAmount() / liquidCapacity, 0.05f);
|
||||
|
||||
if(liquids.total() > 0.001f && timer(timerFlow, 1)){
|
||||
moveLiquidForward(leakResistance, liquids.current());
|
||||
moveLiquidForward(leaks, liquids.current());
|
||||
noSleep();
|
||||
}else{
|
||||
sleep();
|
||||
|
||||
Reference in New Issue
Block a user