[1.3] Children and Pregnancy - v4.1.0

Started by GhostData, March 22, 2020, 04:32:51 PM

Previous topic - Next topic

Zafireria

Since you have taken over, I was wondering if you plan to add race compatibility. Once you have ironed out the bugs and feel happy with the mod of course.

furel

Hi,
I noticed some errors.
1- It's something wrong when a pawn is playing with a baby, is like it's getting stuck in playing with the baby but it can easily break the circle and command other task but if the priority of childcare is high enough it can waste time with the baby when it can do other things. Also this error pops-up in the log.

QuoteLucky started 10 jobs in 10 ticks. List: (PlayWithBaby (Job_2104516) A=Thing_Human309639) , (PlayWithBaby (Job_2104519) A=Thing_Human309639) , (PlayWithBaby (Job_2104520) A=Thing_Human309639) , (PlayWithBaby (Job_2104521) A=Thing_Human309639) , (PlayWithBaby (Job_2104523) A=Thing_Human309639) , (PlayWithBaby (Job_2104525) A=Thing_Human309639) , (PlayWithBaby (Job_2104527) A=Thing_Human309639) , (PlayWithBaby (Job_2104529) A=Thing_Human309639) , (PlayWithBaby (Job_2104530) A=Thing_Human309639)  curDriver=JobDriver_PlayWithBaby (toilIndex=3) curJob=(PlayWithBaby (Job_2104530) A=Thing_Human309639)

2 - When a prisoner has a baby, the baby is not receiving the hediff "child growing" meaning it can move.
Because I have the mod "Prison labor" they can move around my base and access the fridge to get food, after eat, it stay in the fridge until it fall down of hipotermie. If I try to arrest before that happens it can fight back, with is more hilarious cause the baby can seriously injure you.
If I try to force to given the hediff thru Dev mode this error happens.

QuoteException ticking hediff (BabyState ticksSinceCreation=0) for pawn Stepan. Removing hediff... Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorldChildren.Hediff_Baby.TickRare () [0x00084] in <1bcd4ed5171a40d4a2447ffa10e88c86>:0
  at RimWorldChildren.Hediff_Baby.Tick () [0x0001c] in <1bcd4ed5171a40d4a2447ffa10e88c86>:0
  at Verse.Pawn_HealthTracker.HealthTick () [0x00033] in <f022d63938c4495c89633af859c233cf>:0

Also I can't assign it a crib.

Otherwise good work with the mod.

Gutierrez

Can this mod be added to existing saves?

Chezzprinn


heyy

I am running the Royalty expansion and I've found your mod makes me unable to trade with visiting caravans. I have the following other mods installed:

Harmony, Hugslib, Allowtool, Tilled Soil, Hospitality.

It's a slaver caravan, i only have my one starting colonist who is male aged 38. He is a Yeoman with the skill burden. I am in a boreal forest biome.

Ryflamer

While I'm not a C# coder I've messed with HAR related xml quite a bit, so if you're ever interested in getting better compatibility with it. Or if you're interested in updating some of the existing textures for CnP feel free to hit me up on discord as I'd be down to contribute Ryflamer#0175

GhostData

Quote from: Zafireria on March 30, 2020, 02:11:53 PM
Since you have taken over, I was wondering if you plan to add race compatibility. Once you have ironed out the bugs and feel happy with the mod of course.
To the extent that this mod makes it easy for other modders to provide support for their own race, yes. Full support will include custom graphics, which I don't intend to provide. The goal is to have pregnancy be extensible such that a modder may easily (through use of components and inheritance) configure a custom race pregnancy. For example, it should ideally be a minor mod and some graphics to have a pregnancy involve laying an egg instead of a mammalian pregnancy.


Quote from: furel on April 01, 2020, 10:37:31 AM
1- It's something wrong when a pawn is playing with a baby, is like it's getting stuck in playing with the baby but it can easily break the circle and command other task but if the priority of childcare is high enough it can waste time with the baby when it can do other things. Also this error pops-up in the log.

QuoteLucky started 10 jobs in 10 ticks. List: (PlayWithBaby (Job_2104516) A=Thing_Human309639) , (PlayWithBaby (Job_2104519) A=Thing_Human309639) , (PlayWithBaby (Job_2104520) A=Thing_Human309639) , (PlayWithBaby (Job_2104521) A=Thing_Human309639) , (PlayWithBaby (Job_2104523) A=Thing_Human309639) , (PlayWithBaby (Job_2104525) A=Thing_Human309639) , (PlayWithBaby (Job_2104527) A=Thing_Human309639) , (PlayWithBaby (Job_2104529) A=Thing_Human309639) , (PlayWithBaby (Job_2104530) A=Thing_Human309639)  curDriver=JobDriver_PlayWithBaby (toilIndex=3) curJob=(PlayWithBaby (Job_2104530) A=Thing_Human309639)

Childcare is fairly high on the priority list, falling directly below "Doctor." This means that if all priorities are the same, a childcare pawn will choose to take care of children over almost every other possible job. The play job will be performed until the baby's joy meter is full.
I would say that your initial description has it working as designed.
As for the 10 jobs per 10 ticks error, I have a suspicion but haven't confirmed it. It might be that the threshold for starting and stopping the job are the same, causing a pawn to accept and complete the job every tick. I'll see if I can find the cause.


Quote from: furel on April 01, 2020, 10:37:31 AM
2 - When a prisoner has a baby, the baby is not receiving the hediff "child growing" meaning it can move.
Because I have the mod "Prison labor" they can move around my base and access the fridge to get food, after eat, it stay in the fridge until it fall down of hipotermie. If I try to arrest before that happens it can fight back, with is more hilarious cause the baby can seriously injure you.
If I try to force to given the hediff thru Dev mode this error happens.

QuoteException ticking hediff (BabyState ticksSinceCreation=0) for pawn Stepan. Removing hediff... Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorldChildren.Hediff_Baby.TickRare () [0x00084] in <1bcd4ed5171a40d4a2447ffa10e88c86>:0
  at RimWorldChildren.Hediff_Baby.Tick () [0x0001c] in <1bcd4ed5171a40d4a2447ffa10e88c86>:0
  at Verse.Pawn_HealthTracker.HealthTick () [0x00033] in <f022d63938c4495c89633af859c233cf>:0

Also I can't assign it a crib.

Otherwise good work with the mod.
This one is really interesting! Looking at your stack trace, it removed the baby hediff due to an error occurring in the hediff. The new version no longer has that class so I can't exactly replicate that specific error. Further testing show some neat things though.
When I replicated, my baby was born missing the recreation, beauty, comfort, and outdoors needs, which is normal for hostile pawns.

With my setup, a baby born to a prisoner has mom's faction and is hostile to the colony. This brings up a number of questions:
1.Should the baby be hostile until "captured?"
If so, I wonder if pawns will automatically attempt to kill the baby at any point? Technically it's already downed, so I wouldn't think so, but maybe there are other mods that use downed as a status indicator. Would this play nicely with the mod that adds a "finish off" task for downed enemies?
2. Should the baby be automatically "captured" if born to a prisoner? Would this require a prison bed or prison crib to be identified? What if one doesn't exist?
3. What to do about the (probably extremely rare) scenario that a sieger or other invader gives birth while on the map? Based on experience, I am fairly certain the raiders would just abandoned the downed baby. Code would have to be adjusted to avoid giving pawns any childcare jobs for enemy babies!
4. What happens when a baby ages up when assigned to a prison crib? Will we need to reassign them to a prison bed? What if one doesn't exist?

This is a neat problem. I'll see what I can come up with, but baby prisoners are a very odd scenario to begin with, so this might be dropped into a longer term "Feature" list instead of a bug fix. And this is just vanilla, so who knows once you throw in other mods.
Let's put a pin in prison babies for right now. I suggest you toss yours into a nutrient paste dispenser in the meantime, since it's not going to be a hotfix.

Quote from: Gutierrez on April 01, 2020, 01:35:06 PM
Can this mod be added to existing saves?
Not recommended. Version 1.0.0 is still very buggy. Version 2.0.0 is on the way and will introduce save breaking changes as well.
More generally speaking, if you add this to an existing save, any child pawns you currently have will not receive the features that this mod adds. Vanilla only supports pawns age 14+ (I think) so that may not be an issue.

Quote from: Chezzprinn on April 01, 2020, 06:59:15 PM
Would this work fine with CE?
While I've used CE, i don't have a good grasp on what it changes, so I can't say for sure. I used the old version of CNP with CE and never saw any problems myself.

Quote from: heyy on April 02, 2020, 05:40:12 AM
I am running the Royalty expansion and I've found your mod makes me unable to trade with visiting caravans. I have the following other mods installed:

Harmony, Hugslib, Allowtool, Tilled Soil, Hospitality.

It's a slaver caravan, i only have my one starting colonist who is male aged 38. He is a Yeoman with the skill burden. I am in a boreal forest biome.
Can you define "can't trade?" Is there no context menu when right clicking the trader pawn? If there is, is "trade with ..." in the menu? if so, does the colonist walk up and initiate trade with the trader, or just ignores the command? If they walk up, does a onscreen dialog for trading open? Does your pawn have any traits or backstory that disables "social?"
I wasn't able to replicate this with the details provided.

Quote from: Ryflamer on April 02, 2020, 06:21:06 PM
While I'm not a C# coder I've messed with HAR related xml quite a bit, so if you're ever interested in getting better compatibility with it. Or if you're interested in updating some of the existing textures for CnP feel free to hit me up on discord as I'd be down to contribute Ryflamer#0175
Right now I believe alienoid races is patching some of the same methods we are, and based on my current testing, this is causing problems. There are a number of patch changes that will be necessary to (correctly) support alien races, but I haven't taken a super close look at yet. Definitely on the todo list, though.
As for textures, I have no plans to change these just yet. The rendering for a pawn has a ton of graphics for heads, bodies, rotting corpses, skeletal remains, and some other things. It seems CNP attempts to get around all of this by simply hiding the baby's heads and then a handful of custom graphics for bodies, along with the occasional resizing of existing graphics. It's probably worth a review at some point, though.

Quote from: doodoodoo on March 29, 2020, 07:07:45 PM
Quote from: MagicalFungi on March 22, 2020, 11:50:13 PM
added this to an ongoing modded save and had a weird bug while trying to capture fallen enemies with the ui that made it impossible. the popup window for tasks (ie:capture some guy) flashes repeatedly and doesnt work. the window is also slightly offset. when i removed the mod it went back to normal.

hope that helps, GL with the mod. <3

I've had this same issue but I did not add the mod in mid save. The first was when trying to rescue a downed pawn. The option to rescue flickers constantly and I am unable to click the option. The down pawn was from the Androids Tier++ mod. The second time was when a shaman (Rimworld of Magic) hiver (Kenshi Hiver race) trader came in. I could not trade with them because when I right click them, the option flashes constantly. I could, however, trade them if I drafted my pawns. I have this mod loaded toward the bottom of my load order. I hope this helps resolve the issue somewhat.
Several reports for this or similar issues. I haven't seen it in my testing, so it could be interacting poorly with mods that I don't have installed. I have been able to replicate one flashing menu scenario, but it involved non-colonist mom and baby on the same cell, and seemed to be due to non-colonist babies missing some vital components. If the colonist and the trader or downed pawn are older than 14 years old (depending on the race,) I'm not sure why this would happen. CNP bases all of its decisions on the age stage rather than age itself. So if a race defines 150 years old to be age stage 1 (toddler) then CNP will slap a "Baby hediff" on them and disable their work skills.

Quote from: Geese man on March 29, 2020, 07:17:45 PM
So I found another bug when a late stage pregnant colonist ran wild on me.
Infant that are "wild" (from either being born wild or using dev mode to run wild) can walk and appear to be capable of most other things as well (although hard to say since you cant control wild humans) they appear to be able to have all mental breakdowns can be arrested so basically act like a adult pawn but in a infant body.
there seems to be no difference from wild infant being born "naturally" from the mod itself and infant that were spawned using dev tool "T:give birth" (mod spawned infants wont have any stats nor backstory, which the dev spawned ones do have)
They keep the ability to walk after getting tamed and dev mode recruited.

I'll post any more bugs I might find with as much details as I can find.
And thanks for updating this mod.
With my version, babies born to wild women seem to be much like babies born to prisoners, so I will have to look into both at the same time.
It seems these babies are generating without some of the dynamic components they ought to have, such as timetableTracker.
When I forced a colony baby to run wild, the new hediff persisted, so the new system seems to work in that regard.


Thanks for the interest everyone, the reports definitely help. There is only so much one person can test in a short time when working with a game like this, so there will always be things I miss.
2.0.0 will drop soon with some of the most egregious bugs corrected, but it looks like there needs to be a pretty solid road map to integrate with other vital mods.


lbmaian

#37
Oh hey, glad to see someone picked this up.

I was working on updating C&P last year, but lost my source due to a hardware failure, got demotivated and distracted by other modding projects, and only was trying to reconstruct my changes out of sense of obligation of sorts, and at a very low priority at that. I'm pretty relieved that someone's now actually working on and maintaining this "full time".

I don't know how much of my changes are still applicable, but here's the only commits I have that have actual changes (which I've just pushed to gitlab):

Given the 1.1 migration and your other code changes, these commits aren't really mergeable for you, but hopefully, they'll prove helpful. The code audit in particular points out some obvious bugs that should be addressed.

Since I've kinda lost interest in C&P, I probably won't be actively helping out or testing, but if you have any questions, you can contact me on Discord at lbmaian#4515

furel

Quote from: Tragix on April 02, 2020, 09:45:40 PM

Childcare is fairly high on the priority list, falling directly below "Doctor." This means that if all priorities are the same, a childcare pawn will choose to take care of children over almost every other possible job. The play job will be performed until the baby's joy meter is full.
I would say that your initial description has it working as designed.
As for the 10 jobs per 10 ticks error, I have a suspicion but haven't confirmed it. It might be that the threshold for starting and stopping the job are the same, causing a pawn to accept and complete the job every tick. I'll see if I can find the cause.


I have more information about this problem. When a pawn try to play with the baby, he/she start the task and immediately stops and starts again and then stops and repeat this circle, as a result the baby don't fill the recreation need and the pawn can't leave and the baby don't stop to crying, oh my god, that's the most annoying part.
Sometimes they can visit the baby as a hospitalized pawn was and fill the recreation need, which is other thing. Because it treat like a hospitalized pawn, they pick the baby from the crib, carry the baby to hospital bed, feed the baby and some times return to the crib, some times not.

About the prisoner babies, I think they should not be hostile, if it works correct they can't do anything, so kill the baby is something you need to do as direct order or if other mod is interfering.
Right now when a prisoner give birth, the baby is automatically target as prisoner, even if I don't have any crib or bed available, I think it should be in this way. But if I want to take care about that baby, I should have an option to immediately recruitment, because right now I have to persuade a newborn to join my faction.

I hope this information can help you.

Geese man

Quote from: furel on April 03, 2020, 08:28:10 AM
Quote from: Tragix on April 02, 2020, 09:45:40 PM

Childcare is fairly high on the priority list, falling directly below "Doctor." This means that if all priorities are the same, a childcare pawn will choose to take care of children over almost every other possible job. The play job will be performed until the baby's joy meter is full.
I would say that your initial description has it working as designed.
As for the 10 jobs per 10 ticks error, I have a suspicion but haven't confirmed it. It might be that the threshold for starting and stopping the job are the same, causing a pawn to accept and complete the job every tick. I'll see if I can find the cause.


I have more information about this problem. When a pawn try to play with the baby, he/she start the task and immediately stops and starts again and then stops and repeat this circle, as a result the baby don't fill the recreation need and the pawn can't leave and the baby don't stop to crying, oh my god, that's the most annoying part.
Sometimes they can visit the baby as a hospitalized pawn was and fill the recreation need, which is other thing. Because it treat like a hospitalized pawn, they pick the baby from the crib, carry the baby to hospital bed, feed the baby and some times return to the crib, some times not.

About the prisoner babies, I think they should not be hostile, if it works correct they can't do anything, so kill the baby is something you need to do as direct order or if other mod is interfering.
Right now when a prisoner give birth, the baby is automatically target as prisoner, even if I don't have any crib or bed available, I think it should be in this way. But if I want to take care about that baby, I should have an option to immediately recruitment, because right now I have to persuade a newborn to join my faction.

I hope this information can help you.

I don't think any other faction besides your faction is supposed to have pregnant humans, at least that's what I think is most logical (to avoid things like what you described). now assuming that is true, prisoners from any other faction should not be able to be pregnant thus giving birth should be impossible without developer mode interference, thus there should be no need for any "fixes" as its not intended to work that way.
now if it did happen without developer mode or other mods that might have caused it I don't think that be able to straight recruit them should be a thing, would rather like it to be that the baby would be a prisoner from birth immediately but instead of having to recruit it you can take it away from the mother and raise it like a colonist giving the mom (and potentially also imprisoned dad) a debuff something like "-15 child taken from me" or something, with the child having no knowledge of its parents if taken away (easy way would be to simply clear the pawns social log after birth) perhaps no debuff if they got postpartum depression?, but since am fairly convinced it shouldn't happen unless you have a pregnant colonist run wild and you arrest her that any prisoners should be able to give birth.

Zafireria

Quote from: Tragix on April 02, 2020, 09:45:40 PM
Quote from: Zafireria on March 30, 2020, 02:11:53 PM
Since you have taken over, I was wondering if you plan to add race compatibility. Once you have ironed out the bugs and feel happy with the mod of course.
To the extent that this mod makes it easy for other modders to provide support for their own race, yes. Full support will include custom graphics, which I don't intend to provide. The goal is to have pregnancy be extensible such that a modder may easily (through use of components and inheritance) configure a custom race pregnancy. For example, it should ideally be a minor mod and some graphics to have a pregnancy involve laying an egg instead of a mammalian pregnancy.

That sounds great. I assume that should the modder not have added any support, that this mod at least prevents the offspring from breaking or something? I tried using this mod while using custom races and it seems to just ignore them, which is good. I just hope the modders will add support when that's possible.

furel

Quote from: Geese man on April 03, 2020, 04:29:31 PM

I don't think any other faction besides your faction is supposed to have pregnant humans, at least that's what I think is most logical (to avoid things like what you described). now assuming that is true, prisoners from any other faction should not be able to be pregnant thus giving birth should be impossible without developer mode interference, thus there should be no need for any "fixes" as its not intended to work that way.
now if it did happen without developer mode or other mods that might have caused it I don't think that be able to straight recruit them should be a thing, would rather like it to be that the baby would be a prisoner from birth immediately but instead of having to recruit it you can take it away from the mother and raise it like a colonist giving the mom (and potentially also imprisoned dad) a debuff something like "-15 child taken from me" or something, with the child having no knowledge of its parents if taken away (easy way would be to simply clear the pawns social log after birth) perhaps no debuff if they got postpartum depression?, but since am fairly convinced it shouldn't happen unless you have a pregnant colonist run wild and you arrest her that any prisoners should be able to give birth.

Is true I use other mod that manages the pregnancy business, however I haved a slaves prisoners that had a romance while holding them at my base, so it seems a possibility.
I don't know if this is a feature that brings other mod, but I needed to imprisonment one of my pregnant colonist and give birth while was prisoner and the same thing happens, the baby don't recibe the hediff.

Geese man

#42
Quote from: furel on April 03, 2020, 05:46:09 PM
Quote from: Geese man on April 03, 2020, 04:29:31 PM

I don't think any other faction besides your faction is supposed to have pregnant humans, at least that's what I think is most logical (to avoid things like what you described). now assuming that is true, prisoners from any other faction should not be able to be pregnant thus giving birth should be impossible without developer mode interference, thus there should be no need for any "fixes" as its not intended to work that way.
now if it did happen without developer mode or other mods that might have caused it I don't think that be able to straight recruit them should be a thing, would rather like it to be that the baby would be a prisoner from birth immediately but instead of having to recruit it you can take it away from the mother and raise it like a colonist giving the mom (and potentially also imprisoned dad) a debuff something like "-15 child taken from me" or something, with the child having no knowledge of its parents if taken away (easy way would be to simply clear the pawns social log after birth) perhaps no debuff if they got postpartum depression?, but since am fairly convinced it shouldn't happen unless you have a pregnant colonist run wild and you arrest her that any prisoners should be able to give birth.

Is true I use other mod that manages the pregnancy business, however I haved a slaves prisoners that had a romance while holding them at my base, so it seems a possibility.
I don't know if this is a feature that brings other mod, but I needed to imprisonment one of my pregnant colonist and give birth while was prisoner and the same thing happens, the baby don't recibe the hediff.

Now as far as i know the "loving" interaction requires a double bed which i don't think is being used by a lot of people in prisons as imprisoned pairs are pretty rare i would say, most common would be a colonist pair that got arrested to stop a mental break or something but then the baby should belong to your faction already anyway. ok so I just tested 2 scenario's I had colonist couple simply arrested them and gave them a double bed to my luck they did some lovin first night and the woman got pregnant, I developer mode added the hediff "birth soon" to cut the pregnancy short. baby works as intended gets taken to a normal prisoner bed and cant move(this rules out that being a prisoner has anything to do with this, at least in my case). perhaps you could tell which mods you are using? I also tested this with the pirate faction simply spawned 2 pawns arrested them and gave them a relation ship and enabled the always do lovin option (not the case with the colonists) that baby had the issues you described(so I don't know if married pawns from other faction would do the lovin act naturally in prison), thus Tragix this will need a fix although this is not a high priority as it should be a very rare scenario in most playthroughs.

Third_Of_Five

Are there multiple people developing this, or is it just you at the moment? I've been looking through your repo on gitlab and I'd be interested in helping out working on this mod if you'd like my help.

What development environment do you use? Visual Studio? Will MonoDevelop work?

netenugu

Long-term suggestion: Is it possible, without duplicating all the items, to make children's clothing weigh less? Especially when it comes to armor. Thickness of material (and thus armor values) could stay the same, but it would still be smaller.

With the current version, even pawns capable of breastfeeding sometimes use meals to feed babies. What a waste  ;D
And if you use milkable colonists, milk fulness doesn't decrease while breastfeeding. I guess not many people use milkable colonists, so compatibility shouldn't be a high priority, but it would be neat  ;D

Is it possible to imprison babies? Like if it has inwanted traits and you don't want to feed it for years, it would be interesting to just sell it asap.