From 8888f76708ebc5defa5dc2bdb7b6f5108d8b9fc7 Mon Sep 17 00:00:00 2001 From: Reisen Usagi Date: Tue, 22 Mar 2022 20:15:38 -0300 Subject: [PATCH 1/2] Fix NRE when jobdriver partner is null --- 1.3/Source/Comps/CompBodyAnimator.cs | 29 +++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/1.3/Source/Comps/CompBodyAnimator.cs b/1.3/Source/Comps/CompBodyAnimator.cs index 9f5f95c..0d9c966 100644 --- a/1.3/Source/Comps/CompBodyAnimator.cs +++ b/1.3/Source/Comps/CompBodyAnimator.cs @@ -501,14 +501,29 @@ namespace Rimworld_Animations { public bool LoopNeverending() { - if(pawn?.jobs?.curDriver != null && - (pawn.jobs.curDriver is JobDriver_Sex) && (pawn.jobs.curDriver as JobDriver_Sex).neverendingsex || - (pawn.jobs.curDriver is JobDriver_SexBaseReciever) && (pawn.jobs.curDriver as JobDriver_Sex).Partner?.jobs?.curDriver != null && ((pawn.jobs.curDriver as JobDriver_Sex).Partner.jobs.curDriver as JobDriver_Sex).neverendingsex) - { - return true; - } + return IsNeverEndingSex(pawn) || IsNeverEndingSexPartner(pawn); + } - return false; + public static bool IsNeverEndingSex(Pawn pawn) + { + bool hasDriver = pawn?.jobs?.curDriver != null; + if (!hasDriver) + return false; + + return (pawn.jobs.curDriver is JobDriver_Sex jds) && jds.neverendingsex; + } + + public static bool IsNeverEndingSexPartner(Pawn pawn) + { + bool hasDriver = pawn?.jobs?.curDriver != null; + if (!hasDriver) + return false; + + var partner = (pawn.jobs.curDriver is JobDriver_SexBaseReciever jds) ? jds.Partner : null; + if (partner == null) + return false; + + return IsNeverEndingSex(partner); } public void ResetOnLoop() From 3fb106e8f39667e3fccfbec29473383de5a769c9 Mon Sep 17 00:00:00 2001 From: Tory <22203-Tory@users.noreply.gitgud.io> Date: Fri, 29 Mar 2024 17:23:08 +0000 Subject: [PATCH 2/2] Updated Nyaron patch --- 1.4/Patches/RacePatches/Nyaron.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/1.4/Patches/RacePatches/Nyaron.xml b/1.4/Patches/RacePatches/Nyaron.xml index be62f20..c176521 100644 --- a/1.4/Patches/RacePatches/Nyaron.xml +++ b/1.4/Patches/RacePatches/Nyaron.xml @@ -15,6 +15,15 @@ +
  • + Defs/AlienRace.ThingDef_AlienRace[defName = "Alien_Nyaron"]/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[bodyPartLabel="tail"] + + /Defs/AlienRace.ThingDef_AlienRace[defName = "Alien_Nyaron"]/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[bodyPartLabel="tail"] + + false + + +