From b83c76f728ac1eeb84cc0a5e33cb1ce13ece7e9f Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 25 Jan 2021 16:16:38 -0500 Subject: [PATCH] Improved liquid bridge throughput --- core/src/mindustry/entities/comp/BuildingComp.java | 6 +++++- core/src/mindustry/world/blocks/liquid/LiquidBridge.java | 2 +- .../world/blocks/liquid/LiquidExtendingBridge.java | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 76824b6cc3..769530ce94 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -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); } } diff --git a/core/src/mindustry/world/blocks/liquid/LiquidBridge.java b/core/src/mindustry/world/blocks/liquid/LiquidBridge.java index 59205c3c92..83b2fe3e1e 100644 --- a/core/src/mindustry/world/blocks/liquid/LiquidBridge.java +++ b/core/src/mindustry/world/blocks/liquid/LiquidBridge.java @@ -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()); diff --git a/core/src/mindustry/world/blocks/liquid/LiquidExtendingBridge.java b/core/src/mindustry/world/blocks/liquid/LiquidExtendingBridge.java index 76e4929b45..552c348891 100644 --- a/core/src/mindustry/world/blocks/liquid/LiquidExtendingBridge.java +++ b/core/src/mindustry/world/blocks/liquid/LiquidExtendingBridge.java @@ -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());