From 9a432d7d57298814ee49a8cf00928994d09419a3 Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Sat, 7 Sep 2024 08:07:32 -0400 Subject: [PATCH 1/2] Initialize monster baby_timer for new monsters --- src/monster.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index 5da1331f05f43..5644ef3059bd5 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -308,6 +308,9 @@ monster::monster( const mtype_id &id ) : monster() faction = type->default_faction; upgrades = type->upgrades && ( type->half_life || type->age_grow ); reproduces = type->reproduces && type->baby_timer && !monster::has_flag( mon_flag_NO_BREED ); + if( reproduces && type->baby_timer ) { + baby_timer.emplace( calendar::turn + *type->baby_timer ); + } biosignatures = type->biosignatures; if( monster::has_flag( mon_flag_AQUATIC ) ) { fish_population = dice( 1, 20 ); @@ -562,12 +565,6 @@ void monster::try_reproduce() return; } - if( !baby_timer && amount_eaten >= stomach_size ) { - // Assume this is a freshly spawned monster (because baby_timer is not set yet), set the point when it reproduce to somewhere in the future. - // Monsters need to have eaten eat to start their pregnancy timer, but that's all. - baby_timer.emplace( calendar::turn + *type->baby_timer ); - } - bool season_spawn = false; bool season_match = true; From de5b3479e8d9370354ae9ef018e8d93e1edb40f2 Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Sat, 7 Sep 2024 08:43:49 -0400 Subject: [PATCH 2/2] Initialize baby timer for existing animals that didn't get it --- src/savegame_json.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 880791a7d06e4..32684ba67723d 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -2519,6 +2519,8 @@ void monster::load( const JsonObject &data ) data.read( "baby_timer", baby_timer ); if( baby_timer && *baby_timer == calendar::before_time_starts ) { baby_timer.reset(); + } else if( reproduces && type->baby_timer && !baby_timer ) { // Remove after 0.I + baby_timer.emplace( calendar::turn + *type->baby_timer ); } biosignatures = data.get_bool( "biosignatures", type->biosignatures );