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

Initialize monster baby_timer for new monsters #76264

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

RenechCDDA
Copy link
Member

Summary

None

Purpose of change

baby_timer is not set for newly constructed monsters, even those that should have them. Instead, the whole shebang relies on monster::try_reproduce() being called to set the initial value(???)

Describe the solution

Initialize this value in the constructor, when the monster is originally created(/spawned)

Remove the code responsible for setting it in monster::try_reproduce() since it's now useless

Describe alternatives you've considered

Testing

It compiles, will need to do some manual testing before I pull it out of draft

Not looking forward to making sure the stomach size stuff works

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Sep 7, 2024
@PatrikLundell
Copy link
Contributor

Are you sure it's safe to remove the setting in the reproduction code? I'm thinking of the case where an existing save has critters without the value initiated and you then encounter them again, at which time reproduction checks kick in (with the perceived risk of this kicking the game's bucket).
If it's left in, I'd suggest instead leaving a TODO comment stating the date at which it was made logically obsolete, so future cleanup has an easy reference.

@RenechCDDA
Copy link
Member Author

Are you sure it's safe to remove the setting in the reproduction code? I'm thinking of the case where an existing save has critters without the value initiated and you then encounter them again, at which time reproduction checks kick in (with the perceived risk of this kicking the game's bucket). If it's left in, I'd suggest instead leaving a TODO comment stating the date at which it was made logically obsolete, so future cleanup has an easy reference.

optional checks should always be wrapped with checking if the value exists first, but you're right that this could render some creatures permanently sterile. I guess this calls for some save migration

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 7, 2024
@GuardianDll
Copy link
Member

any reason this PR is still in draft?

@RenechCDDA
Copy link
Member Author

Lazy and still haven't tested it properly

@RenechCDDA RenechCDDA marked this pull request as ready for review November 5, 2024 11:09
@github-actions github-actions bot added BasicBuildPassed This PR builds correctly, label assigned by github actions and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Nov 5, 2024
@Night-Pryanik
Copy link
Contributor

Your change means monster no longer need to have eaten to start reproducing?

@GuardianDll
Copy link
Member

Monsters are not required to eat in order to start reproducing; this pr just make them start to reproduce without them being loaded and unloaded first (before, to reproduce, monster needed to be loaded, unloaded, then loaded again, and then unloaded again, and only on third load they were able to start reproducing)

Actually, Renech, did you consider to make it not calendar::turn + *type->baby_timer, but random number between 1 and baby timer?

@RenechCDDA
Copy link
Member Author

Your change means monster no longer need to have eaten to start reproducing?

Yes, but after some thought I considered that 'feature' to be completely broken.

First it only applied to the first feeding. So once they had eaten anything, ever, they were capable of reproducing.

Second, the stuff Guardian mentioned with the on_load shenannigans.

Third, animals have a complete inability to feed themselves, and requiring their breeding to be "turned on" coupled with that meant that wild animals were in most cases never going to breed. In other words, it broke an existing desired feature.

@Maleclypse Maleclypse merged commit c4a19f1 into CleverRaven:master Nov 10, 2024
29 of 43 checks passed
@RenechCDDA RenechCDDA deleted the Init_mon_baby_timer branch November 10, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Monsters Monsters both friendly and unfriendly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants