Skip to content
Snippets Groups Projects
Verified Commit 1fa318c8 authored by Haseiliu's avatar Haseiliu
Browse files

Fix fertility for animals

parent 95348658
No related branches found
No related tags found
No related merge requests found
......@@ -56,22 +56,28 @@ namespace rjw
zeroFertility = race.lifeExpectancy * RJWPregnancySettings.fertility_endage_female_humanlike; // Age when fertility hits 0%.
}
}
foreach (LifeStageAge lifestage in race.lifeStageAges)
//If pawn is an animal, first reproductive lifestage is (usually) adult, so set startMaxAge at first reproductive stage, and startAge at stage before that.
int adult;
if (xxx.is_animal(pawn) && (adult = race.lifeStageAges.FirstIndexOf((ls) => ls.def.reproductive)) > 0)
{
startAge = race.lifeStageAges[adult - 1].minAge;
startMaxAge = race.lifeStageAges[adult].minAge;
}
else
{
if (lifestage.def.reproductive)
//presumably teen stage
if (startAge == 0f && startMaxAge == 0f)
{
startAge = lifestage.minAge;
startMaxAge = (Mathf.Max(startAge + (startAge + endAge) * 0.08f, startAge));
}
//presumably adult stage
else
{
if (startMaxAge > lifestage.minAge)
startMaxAge = lifestage.minAge;
}
foreach (LifeStageAge lifestage in race.lifeStageAges) {
if (lifestage.def.reproductive)
//presumably teen stage
if (startAge == 0f && startMaxAge == 0f) {
startAge = lifestage.minAge;
startMaxAge = (Mathf.Max(startAge + (startAge + endAge) * 0.08f, startAge));
}
//presumably adult stage
else {
if (startMaxAge > lifestage.minAge)
startMaxAge = lifestage.minAge;
}
}
}
//Log.Message(" Fertility ages for " + pawn.Name + " are: " + startAge + ", " + startMaxAge + ", " + endAge + ", " + endMaxAge);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment