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

4 participants
@mlangsdorf
Copy link
Contributor

commented Aug 6, 2018

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.

mlangsdorf added some commits Aug 6, 2018

better milking: keep the cow in place while milking
milking is an extended action, so keep the cow from wandering off while
you milk it.
better milking: don't use source_mon for fill_liquid_do_turn
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.
better milking: rewrite milk_source
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

This comment has been minimized.

Copy link
Member

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?

@mlangsdorf

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2018

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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2018

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

@nexusmrsep

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2018

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.

better milking: have milking take time
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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2018

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.

@mlangsdorf

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2018

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

3 of 4 checks passed

continuous-integration/appveyor/pr AppVeyor was unable to build non-mergeable pull request
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.2%) to 24.452%
Details
gorgon-ghprb Build finished.
Details

farming improvements automation moved this from In progress to Done Aug 7, 2018

@mlangsdorf mlangsdorf deleted the mlangsdorf:better_milking branch Aug 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.