fix: plutonium batteries no longer fully recharge if dropped before first charge cycle#8376
Open
boniondev wants to merge 1 commit intocataclysmbn:mainfrom
Open
fix: plutonium batteries no longer fully recharge if dropped before first charge cycle#8376boniondev wants to merge 1 commit intocataclysmbn:mainfrom
boniondev wants to merge 1 commit intocataclysmbn:mainfrom
Conversation
Signed-off-by: boniondev <55188452+boniondev@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose of change (The Why)
Followup/Fix for an exploit caused by #8342
Professions that spawn with a plutonium battery and drop it before the first charge cycle causes it to fully charge.
Describe the solution (The How)
This adds an item variable that is set to true when the player has it in their inventory. Even if the battery later gets dropped, it will "remember" it has been in a player inventory, and not fully charge, fixing the exploit. Contrary to what I thought,
process_recharge_entryis actually called every tick, it just stops after theonce_everycheck. This can thus be achieved without touching item.cpp.Describe alternatives you've considered
Ideally you'd want to set the item var only once, but we currently do not have hooks/callbacks for when an item is picked up (do we?) (or if spawning with it would even trigger it)
Testing
Additional context
If there is some sort of callback or signal I can use, I'd be glad to use it. I'm not particularly happy with this implementation either.
Checklist
Mandatory
I linked any relevant issues using github keyword syntax likeNo issues have been opened regarding this exploit since it's so newcloses #1234in Summary of the PR so it can be closed automatically.mainso it won't cause conflict when updatingmainbranch later.