RimWorld

RimWorld

Corpse Children
Nox 14 Feb, 2024 @ 4:24pm
So I am getting this -
When I try to raise certain pawns I get this exception :
Exception in Verse.AI.JobDriver.TryActuallyStartNextToil: System.NullReferenceException: Object reference not set to an instance of an object
at CorpseChildren.SurgeryHelper.RegenerateTraits (Verse.Pawn victim, System.Collections.Generic.IEnumerable`1[T] oldTraits) [0x0016f] in <a451c84fdb6241e79388cbd2bb9d4b63>:0
at CorpseChildren.SurgeryHelper.RegenerateTraits (Verse.Pawn newPawn, Verse.Pawn oldPawn) [0x00054] in <a451c84fdb6241e79388cbd2bb9d4b63>:0
at CorpseChildren.JobDriver_ConstructCorpseChild.<MakeNewToils>b__8_1 () [0x003b5] in <a451c84fdb6241e79388cbd2bb9d4b63>:0
at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x00208] in <cd7169108ea74757aa50c5b33d275c15>:0
- transpiler net.pardeike.rimworld.lib.harmony: IEnumerable`1 VisualExceptions.ExceptionsAndActivatorHandler:Transpiler(IEnumerable`1 instructions, MethodBase original)

and then it raises a random pawn and leaves the corpse.

I was able to repro the exception by trying to 'save' the pawn in pawn editor - same problem. It's not a corpse children issue but it's interfering with the reanimate process.

This is the exception from the char editor :

Exception in Verse.Window.InnerWindowOnGUI: System.NullReferenceException: Object reference not set to an instance of an object
at CharacterEditor.MindTool.GetAllNeedsAsSeparatedString (Verse.Pawn p) [0x00009] in <31aeedd25e67475286a4c61702d6ebc1>:0
at CharacterEditor.PresetPawn.SavePawn (Verse.Pawn p, System.Int32 slot) [0x002a4] in <31aeedd25e67475286a4c61702d6ebc1>:0
at CharacterEditor.CEditor+EditorUI+BlockPerson+<>c__DisplayClass64_0.<ASavePawn>b__0 () [0x0003e] in <31aeedd25e67475286a4c61702d6ebc1>:0
at Verse.FloatMenuOption.Chosen (System.Boolean colonistOrdering, Verse.FloatMenu floatMenu) [0x00030] in <cd7169108ea74757aa50c5b33d275c15>:0
at Verse.FloatMenuOption.DoGUI (UnityEngine.Rect rect, System.Boolean colonistOrdering, Verse.FloatMenu floatMenu) [0x00535] in <cd7169108ea74757aa50c5b33d275c15>:0
at Verse.FloatMenu.DoWindowContents (UnityEngine.Rect rect) [0x000fb] in <cd7169108ea74757aa50c5b33d275c15>:0
at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x001fd] in <cd7169108ea74757aa50c5b33d275c15>:0
- transpiler net.pardeike.rimworld.lib.harmony: IEnumerable`1 VisualExceptions.ExceptionsAndActivatorHandler:Transpiler(IEnumerable`1 instructions, MethodBase original)

My guess is that something has added a need to drive a toil task, but it has no name. I'm thinking this is vanilla psycasters. If you have any guesses please share.
Last edited by Nox; 14 Feb, 2024 @ 5:42pm
< >
Showing 1-4 of 4 comments
Nox 15 Feb, 2024 @ 1:35am 
so it's occurring in public static void RegenerateTraits(Pawn victim, IEnumerable<Trait> oldTraits)

I am not sure how to debug this other than breaking out the code and catching suspicious stuff.

It could be the backstory traits coming from medieval backstories collection. That's a mod I just added. Can't really remove it safely since that will lead to pawns null backstory.

I need to figure out how to test this.
Nox 15 Feb, 2024 @ 6:51am 
I read through the code. So the workflow is -

create new pawn
strip old pawn
transfer stats with a .25 reduction
transfer child backstory traits from corpsechild
transfer adult backstory traits from 'victim'

what the outcome is - is a pawn that seems to have diminished stats but no adult trait transfer. only the corpse pawn child trait has been applied.

sometimes it has gear stripped, sometimes it doesn't.

also no hediffs or limb injuries

So my thought is that the most effective way to deal with this is a try/catch around the backstory trait transfers- and being a sloppy fool I'd just throw that catch away and roll on.

what do you think?
Last edited by Nox; 15 Feb, 2024 @ 6:51am
Nox 15 Feb, 2024 @ 4:24pm 
accept my friend request so I can harass you.
Zadodshil_abort17% 17 Feb, 2024 @ 11:43am 
+rep
< >
Showing 1-4 of 4 comments
Per page: 1530 50