Improved liquid bridge throughput
This commit is contained in:
@@ -536,6 +536,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dumpLiquid(Liquid liquid){
|
public void dumpLiquid(Liquid liquid){
|
||||||
|
dumpLiquid(liquid, 2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dumpLiquid(Liquid liquid, float scaling){
|
||||||
int dump = this.cdump;
|
int dump = this.cdump;
|
||||||
|
|
||||||
if(liquids.get(liquid) <= 0.0001f) return;
|
if(liquids.get(liquid) <= 0.0001f) return;
|
||||||
@@ -551,7 +555,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
float ofract = other.liquids.get(liquid) / other.block.liquidCapacity;
|
float ofract = other.liquids.get(liquid) / other.block.liquidCapacity;
|
||||||
float fract = liquids.get(liquid) / block.liquidCapacity;
|
float fract = liquids.get(liquid) / block.liquidCapacity;
|
||||||
|
|
||||||
if(ofract < fract) transferLiquid(other, (fract - ofract) * block.liquidCapacity / 2f, liquid);
|
if(ofract < fract) transferLiquid(other, (fract - ofract) * block.liquidCapacity / scaling, liquid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class LiquidBridge extends ItemBridge{
|
|||||||
|
|
||||||
Building other = world.build(link);
|
Building other = world.build(link);
|
||||||
if(other == null || !linkValid(tile, other.tile())){
|
if(other == null || !linkValid(tile, other.tile())){
|
||||||
dumpLiquid(liquids.current());
|
dumpLiquid(liquids.current(), 1f);
|
||||||
}else{
|
}else{
|
||||||
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
|||||||
|
|
||||||
Building other = world.build(link);
|
Building other = world.build(link);
|
||||||
if(other == null || !linkValid(tile, other.tile())){
|
if(other == null || !linkValid(tile, other.tile())){
|
||||||
dumpLiquid(liquids.current());
|
dumpLiquid(liquids.current(), 1f);
|
||||||
}else{
|
}else{
|
||||||
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user