Improved liquid bridge throughput

This commit is contained in:
Anuken
2021-01-25 16:16:38 -05:00
parent 5930e3c350
commit b83c76f728
3 changed files with 7 additions and 3 deletions

View File

@@ -536,6 +536,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
public void dumpLiquid(Liquid liquid){
dumpLiquid(liquid, 2f);
}
public void dumpLiquid(Liquid liquid, float scaling){
int dump = this.cdump;
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 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);
}
}

View File

@@ -29,7 +29,7 @@ public class LiquidBridge extends ItemBridge{
Building other = world.build(link);
if(other == null || !linkValid(tile, other.tile())){
dumpLiquid(liquids.current());
dumpLiquid(liquids.current(), 1f);
}else{
((ItemBridgeBuild)other).incoming.add(tile.pos());

View File

@@ -28,7 +28,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
Building other = world.build(link);
if(other == null || !linkValid(tile, other.tile())){
dumpLiquid(liquids.current());
dumpLiquid(liquids.current(), 1f);
}else{
((ItemBridgeBuild)other).incoming.add(tile.pos());