Closed nuganee closed 3 years ago
Have you tried disabling this mod to make sure the problem was caused by it?
Yes, and I've also walked through the code (aaand the change suggested above change actually prevents parts size changes for adults).
For uninitialized pawns, growthStage
starts with 0
. In Initialize()
, for pawns younger than adults, GrowToStage()
is called, which sets growthStage
. Which means that after Initialize()
, growthStage
is still 0
for adults.
In CompTickRare()
, where Initialize()
is called, there is later a check for growthStage != ageStage
, which, of course, triggers for adults, and GrowToStage()
is called on them, too.
Which begs the question why there even is a check for non-adulthood in Initialize()
, but whatever.
Reading on, GrowToStage()
doesn't do anything groundbreaking (especially for adults), it mostly applies childhood and bodytype, but it also calls ChangeRJWHediffSeverity()
.
ChangeRJWHediffSeverity()
applies a new size between the old size and a random new size. For all pawns.
In addition to the change noted above, I also suggest modifying the last line of GrowToStage()
as follows:
if(initialized) // if not initialized, pawn just spawned and should already have (age-)appropriate parts; if initialized, this is regular growing
ModTools.ChangeRJWHediffSeverity(pawn, initSize, rand);
That would also prevent changing parts of non-adults after spawn.
I only tested briefly but that seems to do.
PS: I opened an issue for the previous version, but apparently too late: https://gitgud.io/CentAtMoney/babiesandchildren/-/issues/5
Thank you for your detailed explanation. I wasn't able to replicate the issue yesterday but today I can, and I didn't know about CompTickRare()
as well.
I think your first suggestion should be enough as I noticed another problem with ChangeRJWHediffSeverity()
yesterday. That it only applies correctly to babies that born but not children that spawn by other means. So spawned children does not always get age-appropriate parts. (RJW do spawn them with smaller parts but it should be even more smaller and there is a small chance for the parts generated as small,average etc.)
I tested your first suggestion and that seems to do it. And I will remove teenagers size changing on spawn too. Thank you for your help.
Afaik RJW already applies smaller parts to underaged pawns so changing part size on initialisation shouldn't be necessary at all.
I suggest to at least prevent growing of parts for characters that have been created in Character Editor as adults (if I create an adult with small tits, please don't make them large immediately). I assume the easiest way to do so is to set growthStage to Adult stage in Components/Growing_Comp.cs:Initialize()
Or you could come up with another way of only changing parts when growth stage changes, but not if a pawn is freshly spawned. Teen don't need their parts changed either, it's just not as obvious due to size constraints.