Closed ProfoundDarkness closed 5 years ago
OK. I think I found the commit where NPCs stopped healing.
(edit1) When I try reverting the following line back to just update_body() the NPC heals. So the branch through the npc_update_body() seems to be the failure point however that doesn't make sense on (VERY) cursory examination of the logic. Gonna play some more I guess while I'm feeling OK.
(edit2) OK, playing in my favorite place, a debugger (which for some reason the Visual Studio debug compile runs SUPER SLOW, 10+min to load a small save) the linchpin seems to be the last_updated variable which is being updated every second/turn so the code after the if statement is never being executed. The following is the code snippet where the problem lies. To put it another way, the optimization for NPC body processing to happen every 10 seconds will NEVER happen because something else is modifying last_updated every turn.
(edit3) ah, I think I see the root issue, currently playing with a potential fix PR (that doesn't just roll back the optimization).
Describe the bug
NPCs are not healing. In general it seems like most NPC processes that happen over time are not working properly.
Steps To Reproduce
Steps to reproduce the behavior (from a new world/character shelter start):
Steps to reproduce the behavior (from included save file):
Harney.zip
Expected behavior
NPCs heal at least a little bit over time. Somewhat more aside atm, they don't always need sleep.
Screenshots
The screenshots are from my main game to illustrate the problem though now disconnected from steps to reproduce/included save file.
Before going to sleep with NPC allowed to sleep, 12:46:38AM
After waking up, NPC still asleep, 10:05:14AM
Traits of NPC since some can cause healing problems, no bionics.
Versions and configuration
Additional context
As in the reddit post mentioned in #32474 it seems my NPC stopped healing about the time the NPC optimizations were recently done (#32212 and #32342). I don't know if those PRs are the culprit however, just finding agreement with some on reddit that is about when my NPC stopped healing.
Reddit and other places I keep seeing basically a bunch of people talking about how needs are bugged with others responding that those complaining must be using the no needs mod. However once you get through such noise you see that NPCs seem to not be ticking through stuff over time properly.
I'll (probably) try and narrow it down to a particular commit since it's possible it's not the optimization passes. Also I don't expect that collection of mods is necessary.
(edit1) -Modified the steps to reproduce. -Include a handy save file that is (mostly) ready to go. -Also reduced the mod load to basics. -Shifted the focus of the issue towards NPCs not healing. There seems to be something going wrong with the fatigue value on NPCs but it's not completely frozen like health seems to be. Since it might not be related, better to narrow focus than try to keep everything.
(edit2) -Backed up to commit #32342 (d0e5f3d7d5049fa604baa27b807d5b1fff7fc784) and NPC didn't heal. Backed up just one more commit, NPC did heal. That seems to be the problem commit. Also after going one commit back from was the first time I saw an NPC wake up and stay up in testing. -I did try testing other commits after this one, not all of them of course but basically anything I noticed claiming to mess with NPCs, tried testing on that commit then backed up 1 commit and tested again.