CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.26k stars 4.11k forks source link

NPCs returning from camp jobs are dangerously tired and dehydrated #75709

Open XygenSS opened 1 month ago

XygenSS commented 1 month ago

Describe the bug

Playing with No_NPC_Needs disabled, sending followers to camp jobs lasting multiple days will behave as if they have worked non-stop for the entire duration of the job without sleeping or drinking. When you recall a follower from the job, after a few seconds the effect is "caught up" with them, instantly decreasing their stats.

Attach save file

test-trimmed.tar.gz

Steps to reproduce

  1. Send a follower to any camp job that lasts multiple days.
  2. After the job has completed, return the follower. (use debug menu > change date to speed up testing.)
  3. Observe that they are dehydrated and dead tired, or worse

Expected behavior

followers should be taking regular breaks and hydrating themselves even if OSHA isn't around anymore.

Camp jobs should include the sleeping hours in the total job time, or it should be broken into steps to recall followers to rest after a day's worth of work.

Followers should be hydrated during camp jobs either from a basecamp well or from any drinks on their possession. You should be warned if there are inadequate hydration for the follower before starting a camp job.

Screenshots

No response

Versions and configuration

Additional context

What got me into investigating this "bug" in the first place was that I managed to get a follower killed this way during one of my playthroughs. I sent him to a 5-day job crafting lard, he returned with the product, and a few seconds later he instantly died. The only way to save him was to use the debug prevent death mutation. Strangely, his torso HP was set to 1 (presumably it's supposed to be 0, prevented by the debug mutation).

However I could not reproduce follower death on the latest version, nor could I determine the exact cause of death for my follower. You might be able to spot some remains of my reproduction efforts in the attached savefile. Despite this I think the underlying issue still qualifies as a "bug."

PatrikLundell commented 1 month ago

The time taken DOES take off time into account: Most of the time taken for jobs longer than a single work day is off time (I don't remember if the work day is 8 or 10 hours, but there's both idle time and sleep time included). That's accounted for in the calorie consumption as well (calorie consumption during sleep is a lot lower than when working extremely hard). When the companion is returned, the corresponding calories were removed from the calorie store. There's been some recent changes to the calorie store with attempts at nutrients tracking which may or may not have affected things.

It would probably require a total replacement of the camp work logic to somehow account for regular meals and sleep while the camp is outside of the reality bubble (and inside of it as well, for that matter). In fact, doing that would probably require the creation of a camp reality bubble for each camp.

There are reasons companion needs are disabled by default, such as a lot of logic required to feed them in a reasonable manner isn't present.

It may be that the companion feeding logic might require additional code in the companion return handling to cater to the fact that the companion only should have up to a day's worth of sleep buildup (what they had going into the mission + what's been built up from the last work day) and no calorie requirement buildup (because that's all been deducted from the store).