RM13 premature shutdown fix, the Sequel: I need to learn how to Github better #77023
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Fixed RM13 premature shutdown issue"
Purpose of change
Fixes #76926
Describe the solution
Adjusted the logic of the
USE_POWER_WHEN_HIT
if block inarmor_absorb()
so that instead of checking if the amount of incoming damage converted to kJ is greater than the amount of energy consumed by that attack, then deactivating, incoming damage in kJ is compared to the amount of energy remaining.Added a new bool to
energy_remaining()
to allow for only checking the item's batteries, excluding UPS, bionic power and vehicle power.Describe alternatives you've considered
1.) Letting someone more competent than I am fix it.
2.)
Making theJust an if block was causing a drain on the suit when off. Made check explicit.else
block a more explicitelse if
block that checks if the incoming damage is less than the remaining energy.Testing
Loaded the save provided in #76926 with my proposed fix, held the wait button until the armor shut down at the appropriate time, opened up the log and observed the expected unique shutdown message was present.
Additional context
Somehow accidentally closed #76987 while dealing with merge conflicts.
Leaving this as a draft for the moment for feedback and in case I'm missing something.TODO: add check in energy_remaining calls for either UPS or bionic energy toolmods to cover future use cases.Eh. Do this in a future PR.