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

Better milking: make milking a long action that gets all the milk it can #24665

Merged
merged 4 commits into from
Aug 7, 2018

Conversation

mlangsdorf
Copy link
Contributor

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.

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.
@DracoGriffin
Copy link
Contributor

DracoGriffin commented Aug 7, 2018

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?

@DracoGriffin DracoGriffin added <Enhancement / Feature> New features, or enhancements on existing Game: Mechanics Change Code that changes how major features work [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. labels Aug 7, 2018
@mlangsdorf
Copy link
Contributor Author

No, ultra-short milking is not intended.
I'll look at how the siphon code handles this - I think it's a straightforward fix but not 100% sure.

@mlangsdorf
Copy link
Contributor Author

Not a straightforward fix. I need to define a new activity. Grr, argh.

@nexusmrsep
Copy link
Contributor

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.
@mlangsdorf
Copy link
Contributor Author

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.

@DracoGriffin DracoGriffin added the (P2 - High) High priority (for ex. important bugfixes) label Aug 7, 2018
@mlangsdorf
Copy link
Contributor Author

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.

@ZhilkinSerg ZhilkinSerg merged commit 96d52b1 into CleverRaven:master Aug 7, 2018
@mlangsdorf mlangsdorf deleted the better_milking branch August 8, 2018 12:07
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` <Enhancement / Feature> New features, or enhancements on existing Game: Mechanics Change Code that changes how major features work Monsters Monsters both friendly and unfriendly. (P2 - High) High priority (for ex. important bugfixes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants