From a8fa6da7879a1a53940873c526b15d63a9218cb8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 29 Sep 2022 17:20:40 -0400 Subject: [PATCH] Fixed electrolyzer output cap bug --- core/src/mindustry/ai/types/CommandAI.java | 5 +++-- .../world/blocks/production/GenericCrafter.java | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/ai/types/CommandAI.java b/core/src/mindustry/ai/types/CommandAI.java index 8b8b1bb744..db82fbf102 100644 --- a/core/src/mindustry/ai/types/CommandAI.java +++ b/core/src/mindustry/ai/types/CommandAI.java @@ -184,6 +184,9 @@ public class CommandAI extends AIController{ }else if(target != null){ faceTarget(); } + + //boosting control is not supported, so just don't. + unit.updateBoosting(false); } @Override @@ -236,8 +239,6 @@ public class CommandAI extends AIController{ pathId = Vars.controlPath.nextTargetId(); } - - /* //TODO ひどい diff --git a/core/src/mindustry/world/blocks/production/GenericCrafter.java b/core/src/mindustry/world/blocks/production/GenericCrafter.java index fd4e76a9d8..0019307560 100644 --- a/core/src/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/mindustry/world/blocks/production/GenericCrafter.java @@ -240,14 +240,17 @@ public class GenericCrafter extends Block{ @Override public float getProgressIncrease(float baseTime){ //limit progress increase by maximum amount of liquid it can produce - float scaling = 1f; + float scaling = 1f, max = 0f; if(outputLiquids != null){ for(var s : outputLiquids){ - scaling = Math.min(scaling, (liquidCapacity - liquids.get(s.liquid)) / (s.amount * edelta())); + float value = (liquidCapacity - liquids.get(s.liquid)) / (s.amount * edelta()); + scaling = Math.min(scaling, value); + max = Math.max(max, value); } } - return super.getProgressIncrease(baseTime) * scaling; + //when dumping excess take the maximum value instead of the minimum. + return super.getProgressIncrease(baseTime) * (dumpExtraLiquid ? Math.min(max, 1f) : scaling); } public float warmupTarget(){