Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes infinite sleeping pill/chamomile tea bug
Items of type `COMESTIBLE` with `use_action` of type `effect_on_conditions` are not properly consumed upon use despite still applying their effect. This meant that the player could consume an infinite amount of sleeping pills or chamomile tea without actually consuming the item. Changes: - Adjusted `chamomile tea`, `sleeping pills`, and `poppy sleep` to match the behavior of `caffeine pill`. This meant removing the `use_action` and replacing it with `sleepiness_mod` and a negative value. - Added a check to `iuseactor.cpp effect_on_conditons_actor::use` that short circuits the function if it used by an item of type `COMESTIBLE` and prints a debug message describing the issue for future developers. - Added a code comment to `iuseactor.cpp effect_on_conditons_actor::use` describing in detail where the problem lies with using items of type `COMESTIBLE` with `use_action` of type `effect_on_conditions`. - Adjusted the `addiction_type` for `poppysyrup` and `poppy_sleep` to include both `opiate` and `sleeping_pill` Fixes #77525 Fixes #69507 Notes: - I initially thought to use the same behavior as `poppy cough syrup` and apply the `FLUSLEEP` effect to the player, but I decided against it when I found that the `caffeine pill` had a better mechanism for applying a `sleepiness_mod` effect which allows chamomile tea to retain a smaller `sleepiness_mod` value. - I think in the long term these items should use the `use_action` type of `consume_drug` and have an effect detailed in `effects.json` so they are aligned with other drugs (ie. `codeine`). This would allow for `sleepiness` to increment over time instead of applying immediately. See `effects.json` id `dermatik` for an example of this behavior.
- Loading branch information