-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Better milking: make milking a long action that gets all the milk it can #24665
Conversation
milking is an extended action, so keep the cow from wandering off while you milk it.
it's trivial to return the amount of resources consumed when passing an item as the source to fill_liquid_do_turn, and nearly impossible when passing a monster. Since monexamine::milk_source is the only code that passes a source_mon to handle_liquid and then on to fill_liquid_do_turn, simplify life by not passing the source_mon from handle_liquid to fill_liquid_do_turn. Instead, fill_liquid_do_turn takes the milk item that was already being created my milk_source as the source of the transfer liquid activity.
rename milk_per_day to milk_freq, since it's a duration, not a count. remove the redundant check that the milk item is LIQUID - handle_liquid will do that. check the return from handle_liquid, so you don't lose milk if you cancel out of the container selection. increase the size of the milk item to the number of remaining units of milk in the creature. Set the duration of the effect_milked equal to the count of milk units transferred in handle_liquid. Net effect is that a survivor can remove all the milk in a creature in a single long action, if they have a large enough container.
Compiled and tested successfully. Only issues I saw was that milking (regardless of amount milked) only processed a single turn / 6 seconds and perhaps due to the short length of the action, hostile enemies (even with SAFEMODE on) did not prompt any "You see the (monster) nearby! Start milking anyway? Y/N" or "You see the (monster) approaching! Stop milking? Y/N". Is the former simply for easier testing or intended to be that quick? |
No, ultra-short milking is not intended. |
Not a straightforward fix. I need to define a new activity. Grr, argh. |
Story of my github life. Sorry for off topic comment but that was on point. |
Milking takes 2 minutes per 10 units of milk transferred. This isn't an entirely satisfactory solution, but redoing the handle_liquid interface and adding a milking activity is beyond the scope of this PR.
To do this right, I need to split the handle_liquid interface into two parts: one part that gets the destination, and another part that actually does the transfer/starts the fill liquid activity. handle_liquid would become a wrapper for the two parts. I'm not going to do all that in this PR, though I'm going to make that happen. This PR is sufficient for now and a proper milking activity will follow shortly. |
The full milking activity fix is waiting on #24684 and my willingness to dig back into the player_activity code. But mostly on the other part going in. |
Reduce the redundant keypresses for milking a cow by turning the milking action into a long action
and transferring as much milk into the container as either the container will hold or the cow holds.
Also, canceling out of the container selection menu without selecting a container will no longer consume
milk.