Files
Bubberstation/code/modules/reagents
Ghom 9f2eb13d5b Splits reagent metabolization from reagent effects. (#79314)
## About The Pull Request
I've separated the instructions responsible for gradually removing
reagents from a living holder from the main `on_mob_life` and
`on_mob_dead` procs, and made sure they're run after them.

I've done a fair bit of early returns as well.

## Why It's Good For The Game
The problem here is that most reagents will eventually be deleted before
`on_mob_life` and `on_mob_dead` have finished running, since the
statements that handle the reagent removal are found within parent calls
that are often called at the start of the different definitions of the
proc . To make it easier to understand, here's a simplified chain of
events:

holder.metabolize_reagent -> the parent call of reagent.on_mob_life ->
holder.remove_reagent -> holder.update_total ->
reagent.on_mob_end_metabolizate -> reagent.on_mob_delete ->
qdel(reagent) -> the actual reagent.on_mob_life

Basically, the reagent is getting deleted before it has finished
"ticking", and that's bad, simple as that.

Also, by separating these instructions from the rest, we won't have to
enforce any such nuisance as `return ..() || need_mob_update`.

TL;DR: This fixes #79267.

## Changelog

🆑
fix: Fixed the infinite growth serum exploit.
fix: Fixed generic nutriment processing even when dead.
/🆑
2023-11-19 10:48:15 -08:00
..