Coolant display fix

This commit is contained in:
Anuken 2024-04-20 11:36:08 -04:00
parent 3a4f3e7fe7
commit 169a186d63

View File

@ -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<Liquid> 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)));
}
}