Skip to content

fix: plutonium batteries no longer fully recharge if dropped before first charge cycle#8376

Open
boniondev wants to merge 1 commit intocataclysmbn:mainfrom
boniondev:pocket-aware-relics
Open

fix: plutonium batteries no longer fully recharge if dropped before first charge cycle#8376
boniondev wants to merge 1 commit intocataclysmbn:mainfrom
boniondev:pocket-aware-relics

Conversation

@boniondev
Copy link
Contributor

@boniondev boniondev commented Mar 25, 2026

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_entry is actually called every tick, it just stops after the once_every check. 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

  • Spawn plutonium battery inside the inventory
  • Discharge it a bit
  • Drop it before 12 minutes have passed
  • Wait 12 minutes
  • Notice the battery does not fully charge, instead charging normally

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

Signed-off-by: boniondev <55188452+boniondev@users.noreply.github.com>
@github-actions github-actions bot added the src changes related to source code. label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

src changes related to source code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant