Closed RadHazard closed 3 years ago
Hmm... looking through the character code more, I'm starting to think the issue is with the stomach simulation. mod_hunger()
doesn't seem to update the stomach contents at all, and whenever the stomach updates it completely clobbers the current hunger value.
Testing seems to confirm my findings. If you update the NPC's hunger rating in the needs menu then wait 5 minutes, it goes back to what it was before.
are you using the npc no needs mod by any chance?
asking because mod_hunger() & mod_stored_kcal() should indeed not update with it enabled.
Hmm... looking through the character code more, I'm starting to think the issue is with the stomach simulation.
mod_hunger()
doesn't seem to update the stomach contents at all, and whenever the stomach updates it completely clobbers the current hunger value.
I think the problem is that the code is directly putting calories in their stored kcal, not into their stomachs.
are you using the npc no needs mod by any chance?
asking because mod_hunger() & mod_stored_kcal() should indeed not update with it enabled.
I am not using that mod, no
I think the problem is that the code is directly putting calories in their stored kcal, not into their stomachs.
Yeah, that's again what I meant but didn't say clearly :/
The fix should be to just send the calories into their stomach instead, but a quick glance at the stomach shows that it's a fair bit more complicated than just stomach.add_calories()
or something of the like.
I think it would be fairly straightforward to just make a fake food_summary object to feed to the stomach, but I'm not sure if it would be preferable to do that or to try and keep more detailed track of the kinds of foods stuffed into the faction camp. Notably, at the moment I don't think NPCs are getting any vitamins from faction camp food, so a more detailed simulation may be warranted before vitamin deficiencies get changed to actually do something
Describe the bug
NPCs remain perpetually hungry when being fed through faction camp stores. Their stored calories are correctly being updated so they don't actually starve, but their hunger meter remains maxed out, which causes them to complain of hunger and refuse to train you.
Steps To Reproduce
Expected behavior
Feeding NPCs through faction camps fills their stomachs properly so they don't complain of hunger or refuse to train you
Versions and configuration
Additional context
Second half of #47596
The relevant code: https://github.com/CleverRaven/Cataclysm-DDA/blob/0731d8517713c9357b25ac7c6f55eb137432f04e/src/npcmove.cpp#L3818-L3826
While testing this again on the latest version, I've noticed something interesting -- sometimes the hunger does seem to get updated and sometimes it does not. It seems like larger calorie deficits more reliably cause their hunger to go down, while a deficit of only 50 kcal usually causes hunger to remain at maximum. I'm not sure why.