From 169a186d63300ef3e94c544162edf90eb6167bc8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 20 Apr 2024 11:36:08 -0400 Subject: [PATCH] Coolant display fix --- .../blocks/defense/turrets/ReloadTurret.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/defense/turrets/ReloadTurret.java b/core/src/mindustry/world/blocks/defense/turrets/ReloadTurret.java index 5bf13c7c91..8b683c0c29 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/ReloadTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/ReloadTurret.java @@ -1,6 +1,9 @@ package mindustry.world.blocks.defense.turrets; import arc.math.*; +import arc.struct.*; +import arc.util.*; +import mindustry.type.*; import mindustry.world.consumers.*; import mindustry.world.meta.*; @@ -19,7 +22,23 @@ public class ReloadTurret extends BaseTurret{ if(coolant != null){ stats.remove(Stat.booster); - stats.add(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l))); + + //TODO this is very hacky, there is no current way to check if a ConsumeLiquidBase accepts something individually. fix later + ObjectSet notBooster = content.liquids().select(l -> { + for(Consume c : consumers){ + if(!c.booster && c != coolant && + ((c instanceof ConsumeLiquid cl && cl.liquid == l) || + (c instanceof ConsumeLiquids cl2 && Structs.contains(cl2.liquids, s -> s.liquid == l)) || + (c instanceof ConsumeLiquidFilter clf && clf.filter.get(l)))){ + + Log.infoList(this, c, l); + return true; + } + } + return false; + }).asSet(); + + stats.add(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l) && !notBooster.contains(l))); } }