Stop power armors and FB51 optical cloak from eating peoples energy while being inactive #36840
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
SUMMARY: Bugfixes "Fix issues related with UPS-using worn items"
Purpose of change
A few items are processed by player::process_items(). Most of the items are not processed by the function like a good boy. Inactive power armors and inactive FB51 optical cloak should be good boys too and left unprocessed.
Restoration of the natural order of things will fix five unpleasant behaviors:
Your cloaking flickers and becomes opaque.
while there is no power; it should be shown only once.Your power armor disengages.
while there is no power; it should be shown only once.Describe the solution
Before #35295 there was a
if( !w.active ) { continue; }
in thefor( item &w : worn )
loop that preventedcloak
andpower_armor
from pointing inactive items, but it was removed at #35295. Sincecloak
andpower_armor
pointers should only point to active items, I simply restored that behavior by duct-tapingif( w.active )
.Describe alternatives you've considered
if( !w.active ) { continue; }
. Simplerif( w.active )
approach was chosen due to its visibility.&& w.active
at eachif
statements. Felt a little bit duplicative.for
loop. It is kinda meaningless.Character
or something. It is too much hassle.Testing
I astyled it, I compiled it, and I tested it.
Don't panic about the time! I'm not from the future. It's just UTC+09:00.
I also field-tested the changes. Everything worked as expected.
Additional context
tbh I spent too much time on this.