Open vegapnk opened 3 weeks ago
This error seems to persist in 2.1.0, I got an updated Issue by Archer:
@Vegapnk so it happened again, and I frankly do not know how, since it (was?) patched. The relationship bullshit on pawn generation. Mod list is almost empty, just the essentials, so no other cause than rw still poking at single-gender races comes to mind.
the list, was testing bastard raids:
ModList:
Harmony
Fishery
Core
Performance Fish
DLCs
HugsLib
Performance Optimizer
RimJobWorld
RJW Genes
RJW_Unleashed_Traits
RJW_Unleashed_Bastard
RocketMan - Performance Mod
Error:
Error while generating pawn. Rethrowing. Exception: System.NullReferenceException: Object reference not set to an instance of an object
[Ref C40A1F2F]
at RimWorld.SpouseRelationUtility.DetermineManAndWomanSpouses (Verse.Pawn firstPawn, Verse.Pawn secondPawn, Verse.Pawn& man, Verse.Pawn& woman) [0x00000] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at RimWorld.SpouseRelationUtility.ResolveNameForSpouseOnGeneration (Verse.PawnGenerationRequest& request, Verse.Pawn generated) [0x0001d] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at RimWorld.PawnRelationWorker_Sibling.CreateRelation (Verse.Pawn generated, Verse.Pawn other, Verse.PawnGenerationRequest& request) [0x0013b] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.GeneratePawnRelations (Verse.Pawn pawn, Verse.PawnGenerationRequest& request) [0x0012f] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
Code from DetermineManAndWomanSpouses
:
public static void DetermineManAndWomanSpouses(
Pawn firstPawn,
Pawn secondPawn,
out Pawn man,
out Pawn woman)
{
if (firstPawn.gender == secondPawn.gender)
{
man = firstPawn.thingIDNumber < secondPawn.thingIDNumber ? firstPawn : secondPawn;
woman = firstPawn.thingIDNumber < secondPawn.thingIDNumber ? secondPawn : firstPawn;
}
else
{
man = firstPawn.gender == Gender.Male ? firstPawn : secondPawn;
woman = firstPawn.gender == Gender.Female ? firstPawn : secondPawn;
}
}
Code from PawnRelationWorker_Sibling.CreateRelation
:
public override void CreateRelation(
Pawn generated,
Pawn other,
ref PawnGenerationRequest request)
{
int num = other.GetMother() != null ? 1 : 0;
bool flag = other.GetFather() != null;
bool newlyGeneratedParentsWillBeSpousesIfNotGay = (double) Rand.Value < 0.850000023841858;
if (num != 0 && LovePartnerRelationUtility.HasAnyLovePartner(other.GetMother()))
newlyGeneratedParentsWillBeSpousesIfNotGay = false;
if (flag && LovePartnerRelationUtility.HasAnyLovePartner(other.GetFather()))
newlyGeneratedParentsWillBeSpousesIfNotGay = false;
if (num == 0)
{
Pawn parent = PawnRelationWorker_Sibling.GenerateParent(generated, other, Gender.Female, request, newlyGeneratedParentsWillBeSpousesIfNotGay);
other.SetMother(parent);
}
generated.SetMother(other.GetMother());
if (!flag)
{
Pawn parent = PawnRelationWorker_Sibling.GenerateParent(generated, other, Gender.Male, request, newlyGeneratedParentsWillBeSpousesIfNotGay);
other.SetFather(parent);
}
generated.SetFather(other.GetFather());
if (num == 0 || !flag)
{
if ((other.GetMother().story.traits.HasTrait(TraitDefOf.Gay) ? 1 : (other.GetFather().story.traits.HasTrait(TraitDefOf.Gay) ? 1 : 0)) != 0)
other.GetFather().relations.AddDirectRelation(PawnRelationDefOf.ExLover, other.GetMother());
else if (newlyGeneratedParentsWillBeSpousesIfNotGay)
{
Pawn mother = other.GetMother();
Pawn father = other.GetFather();
NameTriple name = mother.Name as NameTriple;
father.relations.AddDirectRelation(PawnRelationDefOf.Spouse, mother);
if (name != null)
{
PawnGenerationRequest request1 = new PawnGenerationRequest();
SpouseRelationUtility.ResolveNameForSpouseOnGeneration(ref request1, mother);
string str1 = name.Last;
string str2 = (string) null;
if (request1.FixedLastName != null)
str1 = request1.FixedLastName;
if (request1.FixedBirthName != null)
str2 = request1.FixedBirthName;
if (mother.story != null && (name.Last != str1 || mother.story.birthLastName != str2))
mother.story.birthLastName = str2;
}
}
else
LovePartnerRelationUtility.GiveRandomExLoverOrExSpouseRelation(other.GetFather(), other.GetMother());
}
PawnRelationWorker_Sibling.ResolveMyName(ref request, generated);
}
To reproduce:
Gives me:
Error while generating pawn. Rethrowing. Exception: System.NullReferenceException: Object reference not set to an instance of an object
[Ref ECB5196A]
at Verse.HediffMaker.MakeHediff (Verse.HediffDef def, Verse.Pawn pawn, Verse.BodyPartRecord partRecord) [0x0001a] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.Pawn_HealthTracker.AddHediff (Verse.HediffDef def, Verse.BodyPartRecord part, System.Nullable`1[T] dinfo, Verse.DamageWorker+DamageResult result) [0x00000] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.HealthUtility.AddStartingHediffs (Verse.Pawn pawn, System.Collections.Generic.List`1[T] startingHediffs) [0x00045] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.GenerateInitialHediffs (Verse.Pawn pawn, Verse.PawnGenerationRequest request) [0x0052e] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.TryGenerateNewPawnInternal (Verse.PawnGenerationRequest& request, System.String& error, System.Boolean ignoreScenarioRequirements, System.Boolean ignoreValidator) [0x00859] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.GenerateNewPawnInternal (Verse.PawnGenerationRequest& request) [0x000c1] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
- PREFIX rjw: Void rjw.Patch_PawnGenerator:Generate_Nymph(PawnGenerationRequest& request)
- POSTFIX rjw: Void rjw.Patch_PawnGenerator:Fix_Nymph(PawnGenerationRequest& request, Pawn& __result)
- POSTFIX rjw: Void rjw.Patch_PawnGenerator:Sexualize_GenerateNewPawnInternal(PawnGenerationRequest& request, Pawn& __result)
- POSTFIX rjw: Void rjw.Patch_PawnGenerator:Fix_Newborn_styles(PawnGenerationRequest& request, Pawn& __result)
at Verse.PawnGenerator.GenerateOrRedressPawnInternal (Verse.PawnGenerationRequest request) [0x00136] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.GeneratePawn (Verse.PawnGenerationRequest request) [0x0000d] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
- POSTFIX RJW_Sexperience: Void RJWSexperience.Rimworld_Patch_GeneratePawn:Postfix(Pawn& __result)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.PawnGenerator.GeneratePawn_Patch1 (Verse.PawnGenerationRequest)
RimWorld.PawnGroupKindWorker_Normal:GeneratePawns (RimWorld.PawnGroupMakerParms,RimWorld.PawnGroupMaker,System.Collections.Generic.List`1<Verse.Pawn>,bool)
...
Or
Exception while generating pawn group: System.NullReferenceException: Object reference not set to an instance of an object
[Ref 78B6AC11]
at Verse.HediffMaker.MakeHediff (Verse.HediffDef def, Verse.Pawn pawn, Verse.BodyPartRecord partRecord) [0x0001a] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.Pawn_HealthTracker.AddHediff (Verse.HediffDef def, Verse.BodyPartRecord part, System.Nullable`1[T] dinfo, Verse.DamageWorker+DamageResult result) [0x00000] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.HealthUtility.AddStartingHediffs (Verse.Pawn pawn, System.Collections.Generic.List`1[T] startingHediffs) [0x00045] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.GenerateInitialHediffs (Verse.Pawn pawn, Verse.PawnGenerationRequest request) [0x0052e] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.TryGenerateNewPawnInternal (Verse.PawnGenerationRequest& request, System.String& error, System.Boolean ignoreScenarioRequirements, System.Boolean ignoreValidator) [0x00859] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.GenerateNewPawnInternal (Verse.PawnGenerationRequest& request) [0x000c1] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
- PREFIX rjw: Void rjw.Patch_PawnGenerator:Generate_Nymph(PawnGenerationRequest& request)
- POSTFIX rjw: Void rjw.Patch_PawnGenerator:Fix_Nymph(PawnGenerationRequest& request, Pawn& __result)
- POSTFIX rjw: Void rjw.Patch_PawnGenerator:Sexualize_GenerateNewPawnInternal(PawnGenerationRequest& request, Pawn& __result)
- POSTFIX rjw: Void rjw.Patch_PawnGenerator:Fix_Newborn_styles(PawnGenerationRequest& request, Pawn& __result)
at Verse.PawnGenerator.GenerateOrRedressPawnInternal (Verse.PawnGenerationRequest request) [0x00136] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at Verse.PawnGenerator.GeneratePawn (Verse.PawnGenerationRequest request) [0x0019d] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
- POSTFIX RJW_Sexperience: Void RJWSexperience.Rimworld_Patch_GeneratePawn:Postfix(Pawn& __result)
at RimWorld.PawnGroupKindWorker_Normal.GeneratePawns (RimWorld.PawnGroupMakerParms parms, RimWorld.PawnGroupMaker groupMaker, System.Collections.Generic.List`1[T] outPawns, System.Boolean errorOnZeroResults) [0x002a5] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at RimWorld.PawnGroupKindWorker.GeneratePawns (RimWorld.PawnGroupMakerParms parms, RimWorld.PawnGroupMaker groupMaker, System.Boolean errorOnZeroResults)
Or this one
Exception while generating pawn group: System.ArgumentException: An item with the same key has already been added. Key: CountOfRapedInsects
[Ref E603D607]
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <eae584ce26bc40229c1b1aa476bfa589>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
at RJWSexperience.SexHistory.RecordRandomizer.GeneratePartnerTypeRecords (Verse.Pawn pawn, System.Int32 avgSexPerYear, System.Int32 sexLifeYears) [0x000ae] in <933a1013bf884b85b93b124b44c3be1d>:0
at RJWSexperience.SexHistory.RecordRandomizer.Randomize (Verse.Pawn pawn) [0x00199] in <933a1013bf884b85b93b124b44c3be1d>:0
at RJWSexperience.Rimworld_Patch_GeneratePawn.Postfix (Verse.Pawn& __result) [0x0002b] in <933a1013bf884b85b93b124b44c3be1d>:0
at Verse.PawnGenerator.GeneratePawn (Verse.PawnGenerationRequest request) [0x001ba] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
- POSTFIX RJW_Sexperience: Void RJWSexperience.Rimworld_Patch_GeneratePawn:Postfix(Pawn& __result)
at RimWorld.PawnGroupKindWorker_Normal.GeneratePawns (RimWorld.PawnGroupMakerParms parms, RimWorld.PawnGroupMaker groupMaker, System.Collections.Generic.List`1[T] outPawns, System.Boolean errorOnZeroResults) [0x002a5] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
at RimWorld.PawnGroupKindWorker.GeneratePawns (RimWorld.PawnGroupMakerParms parms, RimWorld.PawnGroupMaker groupMaker, System.Boolean errorOnZeroResults) [0x00011] in <f0ac5eb9b52e4cc396c70fc9a4ee15e5>:0
I am not super sure if this is my bad, I see a lot of different Issues ...
From Discord:
This happens with the mod Tribals Unleashed, but likely happens with other mods too that have scenarios.
Jaal has it fixed in His Fork. He says the file was already there and disappeared but I promise I am innocent, I checked my git history.