diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index badcbc1d5f..b694f51db8 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -997,6 +997,10 @@ public class Block extends UnlockableContent implements Senseable{ return consume(new ConsumeCoolant(amount)); } + public ConsumeCoolant consumeCoolant(float amount, boolean allowLiquid, boolean allowGas){ + return consume(new ConsumeCoolant(amount, allowLiquid, allowGas)); + } + public T consume(T consume){ if(consume instanceof ConsumePower){ //there can only be one power consumer diff --git a/core/src/mindustry/world/consumers/ConsumeCoolant.java b/core/src/mindustry/world/consumers/ConsumeCoolant.java index 0afdd55a09..9ff7a9b57d 100644 --- a/core/src/mindustry/world/consumers/ConsumeCoolant.java +++ b/core/src/mindustry/world/consumers/ConsumeCoolant.java @@ -3,11 +3,19 @@ package mindustry.world.consumers; /** A ConsumeLiquidFilter that consumes specific coolant, selected based on stats. */ public class ConsumeCoolant extends ConsumeLiquidFilter{ public float maxTemp = 0.5f, maxFlammability = 0.1f; + public boolean allowLiquid = true, allowGas = false; - public ConsumeCoolant(float amount){ - this.filter = liquid -> liquid.coolant && !liquid.gas && liquid.temperature <= maxTemp && liquid.flammability < maxFlammability; + public ConsumeCoolant(float amount, boolean allowLiquid, boolean allowGas){ + this.allowLiquid = allowLiquid; + this.allowGas = allowGas; + + this.filter = liquid -> liquid.coolant && (this.allowLiquid && !liquid.gas || this.allowGas && liquid.gas) && liquid.temperature <= maxTemp && liquid.flammability < maxFlammability; this.amount = amount; } + + public ConsumeCoolant(float amount){ + this(amount, true, false); + } public ConsumeCoolant(){ this(1f);