Initialize monster baby_timer for new monsters
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
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.
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
any reason this PR is still in draft?
Lazy and still haven't tested it properly
Your change means monster no longer need to have eaten to start reproducing?
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?
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.