Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto eat and drink from auto-zones during long activities/waiting #36543

Merged
merged 11 commits into from Apr 4, 2020
Merged

Auto eat and drink from auto-zones during long activities/waiting #36543

merged 11 commits into from Apr 4, 2020

Conversation

ghost
Copy link

@ghost ghost commented Dec 29, 2019

Summary

SUMMARY: Features "Auto eat and drink from auto-zones during long activities/waiting"

Purpose of change

Fixes #30415
Auto eat and drink from auto-zones during long activities/waiting

Describe the solution

Added two new zones : auto_eat and auto_drink.
Items placed here are considered by the player to be available for autoconsuming, it could be placed over loot zones to make your own food zone also an autoeat zone etc.

Then during a long activity, same as with refuelling fires, it will check for significant thirst or hunger, and if need be will find the nearest autoconsume zone, and consume a valid comestible there, and subtract a small number of moves to abstract the fetching of the item, same as loot sorting does, then continues the main activity.

This will help with long-term activities like reading, long crafting sessions etc, no need to stop and start so much to get some food/drink.

Also if for some reason you just want to wait for a long time, thisll make it easier to do so.

Describe alternatives you've considered

N/A

Testing

New character, added zones, added different types of food and drink to the autoconsume zones.
waited for days until got very hungry ( got thirsty enough every few hours ), bottles of water were drunk and empty bottles placed back on the map, no infinite drinking loops or anything weird.
Food in containers were handled properly, raw meat wasnt eaten, rotten food wasnt eaten etc.

Additional context

I tried to be as smart as I could with the filtering of what items were considered good to eat, in the list of things it checks for before choosing the item to eat, but if ive forgotten anything please let me know.

Also next up, but probably needs some different handling of the context of when itd be useful, is autosleep too - automatically pathing to the nearest bed and going to sleep , durng long activities, then waking up, eating, drinking, and resuming activity etc.

src/clzones.cpp Outdated Show resolved Hide resolved
@KorGgenT KorGgenT added [C++] Changes (can be) made in C++. Previously named `Code` Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA Mechanics: Character / Player Character / Player mechanics labels Dec 29, 2019
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Show resolved Hide resolved
src/activity_handlers.h Outdated Show resolved Hide resolved
src/player_activity.cpp Outdated Show resolved Hide resolved
@Shibimon
Copy link

I dont know how to read the changes and you probably thought of it but for being extra sure, do check it specially gives priority to eating food in already open presserving containers before opening more.

src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
src/player_activity.cpp Outdated Show resolved Hide resolved
@Amoebka
Copy link
Contributor

Amoebka commented Jan 5, 2020

Does it understand morale effects of food yet? If a player has heaps of different food types stashed they want to be eating different ones every time because of the stacking morale bonus decay. Morale (focus) are especially important for long-term projects.
Probably doesn't belong here, but there should also be mp3 player (and other battery-based appliances) auto-reloading, for the same focus reasons.
Ultimately, if the automatic system isn't smart enough, players will feel forced to still do things manually not to lose efficiency.

@ghost
Copy link
Author

ghost commented Jan 6, 2020

Does it understand morale effects of food yet? If a player has heaps of different food types stashed they want to be eating different ones every time because of the stacking morale bonus decay. Morale (focus) are especially important for long-term projects.
Probably doesn't belong here, but there should also be mp3 player (and other battery-based appliances) auto-reloading, for the same focus reasons.
Ultimately, if the automatic system isn't smart enough, players will feel forced to still do things manually not to lose efficiency.

This isnt designed to optimise focus, its designed to stop people starving, and to stop annoying pauses in long activities to eat and drink and then resume it.

If it gets smarter in the future, thta would be best served by a rules-based UI like the autopickup manager.

@Funguss
Copy link
Contributor

Funguss commented Feb 27, 2020

Well, one nice touch would be automatically using a hotplate or hobo stove or whatever if the food is better hot. Also if it's frozen and needs warming to be eaten, as I imagine many would like to utilise this with a freezer.

@ghost ghost requested a review from John-Candlebury as a code owner March 6, 2020 19:16
@ghost ghost changed the base branch from master to dev March 6, 2020 19:16
@ZhilkinSerg ZhilkinSerg changed the base branch from dev to master April 2, 2020 14:31
@ghost
Copy link
Author

ghost commented Apr 3, 2020

Rebased, cleaned, retested - working.

@ZhilkinSerg ZhilkinSerg merged commit 2051779 into CleverRaven:master Apr 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Character / Player Character / Player mechanics Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Auto-eat" zones: Snack while you study.
9 participants