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

Change milking to an activity, restore udders on load catchup #37523

Merged
merged 3 commits into from Feb 4, 2020
Merged

Change milking to an activity, restore udders on load catchup #37523

merged 3 commits into from Feb 4, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jan 29, 2020

Summary

SUMMARY: Bugfixes "Change milking to an activity, restore udders on load catchup"

Purpose of change

Fixes #36826

Describe the solution

Instead of subtracting moves and adding a timed effect to the cow, turn milking into an interruptable activity.
This now takes around 25 minutes in-game ( as per googling hand-milking cow time tells me ) but the real time it takes is around the same, as before subtracting movs just made the seconds tick by slowly.

also , the udders now refill every day, either oncatchup on load, or in reality bubble, which acts the same as the checking for the effect did in monexamine.cpp but is more robust now, and potentially ready for NPC milking activities in the future.

also added try_reproduce() and biosig ( poop ) to the monster do turn once_every( 1_days ) check, so now animals can poop and lay eggs whilst in reality bubble too.

Describe alternatives you've considered

N/A

Testing

I did a lot of milking, teleporting, and waiting. all seems ok.

Additional context

N/A

@Brian-Otten
Copy link
Contributor

I feel slightly guilty for sending you off course into this rabbit hole and very thankful that you got it done. Don't have a equal/better understanding of the code than you to do a meaningful review of it but the milking time changes seem perfect.

src/activity_handlers.cpp Outdated Show resolved Hide resolved
src/activity_handlers.cpp Show resolved Hide resolved
src/game.cpp Show resolved Hide resolved
@@ -548,6 +549,7 @@ class monster : public Creature
cata::optional<time_point> baby_timer;
bool biosignatures;
cata::optional<time_point> biosig_timer;
time_point udder_timer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous approach (adding an effect) was sound. Can it still be used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effects do not progress outside of the reality bubble.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it fast-forwarded when the player re-enters the reality bubble. If it's not, I'd consider that a bug.

src/monster.cpp Outdated Show resolved Hide resolved
src/monexamine.cpp Outdated Show resolved Hide resolved
src/activity_handlers.cpp Outdated Show resolved Hide resolved
src/activity_handlers.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Character / Player Character / Player mechanics 0.E Feature Freeze and removed 0.E Feature Freeze labels Jan 30, 2020
dpwb and others added 3 commits February 2, 2020 09:43
erroneous edit to mtype.h

from review: use iterator instead of map directly

add check for udders being empty in milk_finish

add serialization for udder timer

from review : const int and use iterator instead of map directly

add checking for temp_tie effect removal

Update src/activity_handlers.cpp

Co-Authored-By: BevapDin <tho_ki@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Character / Player Character / Player mechanics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cows do not produce milk outside reality bubble
4 participants