[1.3] Children and Pregnancy - v4.1.0

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

Previous topic - Next topic

GhostData

#255
Quote from: lbmaian on June 18, 2020, 02:35:09 PM
To get soft dependencies to work, you must be aware of .NET type lazy loading works.

When a method that directly references a type - regardless of runtime checks (like only conditionally patching) - the .NET runtime will attempt to load that type. Obviously, if that type is in another assembly and that assembly doesn't exist at runtime, a TypeLoadException is thrown. (This also matters for whether the static constructor is run.)

You have two alternative ways of accessing another type while respecting runtime conditions within a method:

1) Use only reflection. Never directly reference a type in the other assembly in the method.

2) Wrap all access to types in the other assembly in its own type (and methods), even as a nested type (loading a type does NOT automatically load types nested within that type), and conditionally use that type (and call its methods).

2a) One very convenient trick is to wrap all access to those types in a lambda like this:
((Action)(() =>
{
    // all code that access types in other assembly goes here
}))();

This takes advantage of the fact that lambdas are compiled into an internal class (i.e. another type) which the calling method then uses.
Very useful advice. I figured out that types aren't loaded until referenced while sorting out the harmony patching, but didn't know I could wrap a dependency class or use anonymous classes like that. Thanks for the pointers!

3.0.4 released
https://gitlab.com/Tragix/children-and-pregnancy-collab/-/tags/v3.0.4
I managed to identify and fix the issue with baby pawns only sleeping to 15% even when not "unhappy." I don't fully understand how the boolean expression evaluated to true since one component was very clearly false. Either way, it should be fixed now.

It seems in C#, the null coalesce operator takes precedence over conditional operators. If the case I ran into holds true, then the expression
if (null ?? true && false)
will actually evaluate to true. Now that I think on it, it makes a kind-of sense. The operator might short circuit the rest of the expression assuming that the null reference should evaluate the full expression as true. What's interesting is that the coalescing expression should not have evaluated to the fall back option at all, so even though the expression p.TryGetComp<LifecycleComp>()?.CurrentLifestage?.wakeOnUnhappy ?? false evaluated to true, it still seems to have short circuited. Interesting problem.

TangyPango

#256
Hello, I was told to come here from Steam to report any bugs. Not sure if these were already reported but here are some I found:

1. Babies used to be headless adults but after the most recent update, they are now pink squares. At least they are easier to find now (still appear as headless adults on the colonist bar).

2. All colonists (regardless of age) are considered children and are taken to beds to be fed by those assigned to childcare, even if they are already eating. Since pawns move very slowly when carrying adults, this takes up a lot of time when they could be doing more resourceful activities.

3. Some corpses that were wearing normal clothes when they died are now wearing smaller clothes. So they just look like naked corpses that had a child-sized outfit thrown on top of them.

Most of these aren't really game-breaking, just minor inconveniences (especially the second one).

[email protected]

anyone have issues with this interacting with android tiers?
apparently since my androids at 1-10 years old, their graphics seem to have gotta overwritten somehow, now they are pink blocks!
this happened after i added children and pregnancy to an existing game

Canute

Android babies ? Did you broke the android printer ?
Some races need to be excluded !!

amato.stano

Hi,
I really love this mod.
My first playthough in B18, I think, I got the children to 15 years old.
I'm trying to do the same in 1.1 now but after 150 days and 2 married couples from the start no pregnancies.
I was planning on accelarating the aging so the game would factor in generations better, but with no babies it is pointless.

It may be a mod incompatibility, what do you think ?
Here is the list, please could you point out the ones you don't know, don't use or think they might be a problem...

Harmony
Core
JecsTools
Edb Prepare Carefully
Children and Pregnancy
[1.1] Psychology (unofficial)
Hospitality
Character Editor
Colony Manager
Vanilla Fishing
Work Tab
[KV] Change Dresser - 1.1
Death rattle unofficial
Dubs Break mod
ED-EnhancedOptions
Faster Aging
Fluffy Breakdowns
Mass cooking
Medical Tab
Pick up and Haul Unofficial
Quarry 1.1
Rah's Bionic and Surgery Expansion
Realistic Rooms
Research Tree
[KV] RimFridge - 1.1
RimHUD
Rimsenal - Rimhair
RimTaser Reloaded
Tech Advancing
Vanilla Furniture Expanded - Power
Vanilla Texture Expanded
Rercipe Icons

Thanks for any input.

GhostData

Quote from: amato.stano on June 24, 2020, 02:50:54 AM
Hi,
I really love this mod.
My first playthough in B18, I think, I got the children to 15 years old.
I'm trying to do the same in 1.1 now but after 150 days and 2 married couples from the start no pregnancies.
I was planning on accelarating the aging so the game would factor in generations better, but with no babies it is pointless.

It may be a mod incompatibility, what do you think ?
Here is the list, please could you point out the ones you don't know, don't use or think they might be a problem...

Harmony
Core
JecsTools
Edb Prepare Carefully
Children and Pregnancy
[1.1] Psychology (unofficial)
Hospitality
Character Editor
Colony Manager
Vanilla Fishing
Work Tab
[KV] Change Dresser - 1.1
Death rattle unofficial
Dubs Break mod
ED-EnhancedOptions
Faster Aging
Fluffy Breakdowns
Mass cooking
Medical Tab
Pick up and Haul Unofficial
Quarry 1.1
Rah's Bionic and Surgery Expansion
Realistic Rooms
Research Tree
[KV] RimFridge - 1.1
RimHUD
Rimsenal - Rimhair
RimTaser Reloaded
Tech Advancing
Vanilla Furniture Expanded - Power
Vanilla Texture Expanded
Rercipe Icons

Thanks for any input.
Turn on dev logging in the CNP settings and check the logs with `. There will be a print out of the % chance of success for pregnancy attempts between two pawns. Certain factors such as age may cause that chance to be 0.

amato.stano

Found this error in debug during Lovin' with a new game with only Harmony, Core, HubsLib, Edb Prepare Carefully and Children and Pregnancy.

Exception in JobDriver tick for pawn Jinx driver=JobDriver_Lovin (toilIndex=4) driver.job=(Lovin (Job_20983) A=Thing_Human914 B=Thing_RoyalBed37906)
System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0
  at RimWorldChildren.Hediff_Pregnancy+<>c.<get_HediffOfClass>b__7_0 (System.Reflection.Assembly a) [0x00000] in <f1be4809cdb24fa1b4d128854812276f>:0
  at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x00051] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
  at RimWorldChildren.Hediff_Pregnancy.get_HediffOfClass () [0x00081] in <f1be4809cdb24fa1b4d128854812276f>:0
  at RimWorldChildren.Hediff_Pregnancy.Create[T] (Verse.Pawn mother, Verse.Pawn father) [0x00035] in <f1be4809cdb24fa1b4d128854812276f>:0
  at RimWorldChildren.Lovin_Override.TryToImpregnate (Verse.Pawn initiator, Verse.Pawn partner) [0x00281] in <f1be4809cdb24fa1b4d128854812276f>:0
  at RimWorldChildren.Lovin_Override.JobDriver_Lovin_Patch (Verse.AI.JobDriver __instance, Verse.AI.JobCondition condition) [0x0003f] in <f1be4809cdb24fa1b4d128854812276f>:0
  at (wrapper dynamic-method) Verse.AI.JobDriver.DMD<DMD<Cleanup_Patch1>?-1752607872::Cleanup_Patch1>(Verse.AI.JobDriver,Verse.AI.JobCondition)
  at Verse.AI.Pawn_JobTracker.CleanupCurrentJob (Verse.AI.JobCondition condition, System.Boolean releaseReservations, System.Boolean cancelBusyStancesSoft, System.Boolean canReturnToPool) [0x00085] in <642567a9bd804f26a9090d82e2c3673d>:0
  at Verse.AI.Pawn_JobTracker.EndCurrentJob (Verse.AI.JobCondition condition, System.Boolean startNewJob, System.Boolean canReturnToPool) [0x000e1] in <642567a9bd804f26a9090d82e2c3673d>:0
  at Verse.AI.JobDriver.EndJobWith (Verse.AI.JobCondition condition) [0x00028] in <642567a9bd804f26a9090d82e2c3673d>:0
  at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x000ee] in <642567a9bd804f26a9090d82e2c3673d>:0
  at Verse.AI.JobDriver.ReadyForNextToil () [0x00007] in <642567a9bd804f26a9090d82e2c3673d>:0
  at RimWorld.JobDriver_Lovin.<MakeNewToils>b__11_3 () [0x00017] in <642567a9bd804f26a9090d82e2c3673d>:0
  at Verse.AI.JobDriver.DriverTick () [0x00156] in <642567a9bd804f26a9090d82e2c3673d>:0
Verse.Log:Error(String, Boolean)
Verse.AI.JobUtility:TryStartErrorRecoverJob(Pawn, String, Exception, JobDriver)
Verse.AI.JobDriver:DriverTick()
Verse.AI.Pawn_JobTracker:JobTrackerTick()
Verse.Pawn:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()

Capitolio

I know this has probably already been discussed, but is there any chance that this mod will be compatible with Facial Stuff?

The author has made it clear that he will no longer work on compatibility issues. He says both mods are no longer compatible because of a patch introduced by C&P, which cancels certain Facial Stuff checks. Whether this is true or not I don't know.

Also, in case this is useful, it is no longer the age but the size of the pawn that determines if Facial Stuff should render the head or not.

Tenshi~Akari

Quote from: Capitolio on June 25, 2020, 07:57:51 AM
I know this has probably already been discussed, but is there any chance that this mod will be compatible with Facial Stuff?

The author has made it clear that he will no longer work on compatibility issues. He says both mods are no longer compatible because of a patch introduced by C&P, which cancels certain Facial Stuff checks. Whether this is true or not I don't know.

Also, in case this is useful, it is no longer the age but the size of the pawn that determines if Facial Stuff should render the head or not.

I was wondering about this issue as well. While I admit it would be cool if the animations fit child pawns as an option, at current, all I'm seeing are child pawns spawning with hands & feet that don't animate, and naturally eyes & mouths that don't fit the head positioning. (Originally, all of that was disabled by the checks mentioned. Funny enough, before this mod got updated to 3.0, those animations were working with child pawns a bit, but the clothes were being drawn in the adult bodytype sizes. And, of course, the toddler and newborn rendering issues of having floating feet/hair/hands...)

I completely understand giving up on compatibility, though, both Facial Stuff and Children and Pregnancy are huge mods in their own rights... but one can dream somebody would be daring enough to patch that in someday.

GhostData

Quote from: amato.stano on June 24, 2020, 05:05:55 PM
Found this error in debug during Lovin' with a new game with only Harmony, Core, HubsLib, Edb Prepare Carefully and Children and Pregnancy.

Exception in JobDriver tick for pawn Jinx driver=JobDriver_Lovin (toilIndex=4) driver.job=(Lovin (Job_20983) A=Thing_Human914 B=Thing_RoyalBed37906)
Mmmm, maybe an issue with Alien Races not being installed? Several other reports from vanilla code trying to load types using reflection, but I'm not really sure what's going on with that yet. Not sure if it's a HAR class I am referencing somehow being loaded, or something else. I'll try to replicate.

Quote from: Capitolio on June 25, 2020, 07:57:51 AM
I know this has probably already been discussed, but is there any chance that this mod will be compatible with Facial Stuff?

The author has made it clear that he will no longer work on compatibility issues. He says both mods are no longer compatible because of a patch introduced by C&P, which cancels certain Facial Stuff checks. Whether this is true or not I don't know.

Also, in case this is useful, it is no longer the age but the size of the pawn that determines if Facial Stuff should render the head or not.
I'll look into it when I have time. If it's just something we're patching that's causing it not to work, I'll see what I can do to fix that. It is a difficult line to draw as to which mod should support the other. Both add a new feature that reduces the functionality of the other if not patched, so it could technically make sense for either mod to provide that support. I am being careful to follow a general policy of "If it could work with CNP without patches, don't break it further" and so will fix any errors I cause to that end. I don't want to fall into the trap of providing CNP-side support for every mod out there.
HAR is a notable exception because I personally feel that alien race support is vital to a mod like CNP. It might not be perfect at the moment, but I do think it's important for the core purpose of CNP. Facial animations - not so much. And for babies and toddlers, there may not even be enough space on the pawn to display faces. In all cases, I have no plans to make "baby appropriate" graphics for body addons and similar.


amato.stano

Quote from: Tragix on June 25, 2020, 09:37:32 PM
Mmmm, maybe an issue with Alien Races not being installed? Several other reports from vanilla code trying to load types using reflection, but I'm not really sure what's going on with that yet. Not sure if it's a HAR class I am referencing somehow being loaded, or something else. I'll try to replicate.

Indeed, adding Humanoid Alien Races got rid of the error and managed to have pregnancies and babies.

Thanks

Hilvon1984

Ok. Still having issues with game stutter in some conditions, but managed to isolate it a little further.
The absolute worse stutter occures when several conditions are met simultaneously:
1) A Child is in disstress (crying).
2) Child is outdoors.
3) The space the child is in is rather enclosed (in my case it is a 3-tile wide street between 2 buildings).

I tried monitoring the situation with DubsPerformance mod, and the stutters appear on the performance graphs as a 200ms load on PawnTick.JobTrackerTick.

Also another kind of annoying thing is the babies were actually having a nap, while being on mental break. This made it so they did not collapse from exhaustion ending the mental break prematurely, and were roaming for the whole duration. (including wandering into the LagStreet which is normally out of allowed area to avoid this issue).

And the problem with "Childcarers" grabbing any hungry pawn to feed, rather than just babies.

Anyway, maybe you can make it so that a baby that is crying will become downed automatically?

Kori

Hello! Thank you very much for maintaining this great mod and all the improvements you already made, I really could not enjoy Rimworld without it! :)

Since the 3.0 update I noticed that when I play the game for a longer period of time it sometimes starts to lag. Also when I try to quit the game it takes a very long time to finally close, and sometimes it just crashes after some waiting time. It happens after playtimes of 1+ hours.
Some people on the Steam workshop also reported that with the new version there seems to be a memory leak issue which causes that.
Are you already aware of that?
Thank you in advance! :)

notfood

Recent update broke Pawnmorpher, it used to work fine.


Geese man

#269
Could it be made that infants can wear a beanie and onesie as the onesie description says: "A simple garment worn by an infant",
I know you normally cannot dress downed pawns but with the "dress patients" mod you can.

Also trauma savant toddlers have 50% manipulation perhaps patch that?

children with night owl trait are still scared of the dark.