Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Prevent LEG from drawing significantly higher amounts of coolant than expected #243

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

ReaganAR
Copy link

Fixes issue GTNewHorizons/GT-New-Horizons-Modpack#14104 by moving getPerAspectEnergy call into EU generation loop.

As an example, some sample data from supplying Ira with cryotheum as the coolant, over 60s+:

Tier Expected Coolant Draw Current Coolant Draw This PR
HV 4A 0.9503 200.83 0.944
EV 4A 3.8014 203.27 3.8282

And with Adept hatches instead of novice:

Tier Expected Current This PR
EV 4A 1.907 200.42 1.99
IV 4A 7.6028 201.878 7.802

@boubou19 boubou19 requested a review from AbdielKavash March 12, 2024 13:57
@Dream-Master Dream-Master requested a review from a team March 12, 2024 16:05
Copy link
Member

@AbdielKavash AbdielKavash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 437-443:

            if (EUt == 0 && aspects.size() != 0) {
                if (!isValidEssentia(aspects.getAspects()[0]) || getPerAspectEnergy(aspects.getAspects()[0]) == 0)
                    continue;
                EUt += getPerAspectEnergy(aspects.getAspects()[0]) * mStableValue / 25;
                aspects.reduce(aspects.getAspects()[0], 1);
                if (aspects.getAmount(aspects.getAspects()[0]) == 0) aspects.remove(aspects.getAspects()[0]);
            }

This section should be completely removed. If the code ever gets here with EUt == 0, this means that the previous loop did not find any valid essentia in the input hatch. Trying the zeroth essentia again won't help, it calls the problematic getPerAspectEnergy again (several times), and is otherwise useless and confusing.


Ideally I would prefer a rewrite to use ProcessingLogic or similar (I am not sure what state essentia support for this is in), but after addressing the comment below this works as a quick fix.

@ReaganAR ReaganAR requested a review from AbdielKavash March 12, 2024 18:43
@Dream-Master Dream-Master merged commit e48eaf0 into GTNewHorizons:master Mar 12, 2024
1 check passed
@ReaganAR ReaganAR deleted the coolant-fix branch March 12, 2024 19:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants