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 bf8570287a0b6d2b7806b92f43a6494e04cd6ae9 Mon Sep 17 00:00:00 2001 From: c0ffee Date: Fri, 3 Feb 2023 12:57:13 -0800 Subject: [PATCH 2/2] rebuild for HAR --- .../Assemblies/Patch_HumanoidAlienRaces.dll | Bin 9216 -> 9216 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Patch_HumanoidAlienRaces/1.4/Assemblies/Patch_HumanoidAlienRaces.dll b/Patch_HumanoidAlienRaces/1.4/Assemblies/Patch_HumanoidAlienRaces.dll index 0a84cad9abe1ae22274f10c54f6039671242e199..2736148fc35d5bd94fa80d6799ae3e6e67c0f100 100644 GIT binary patch delta 411 zcmW-bPbj2u9LB#7zjx;QzBBJ&kUup$2M)6&he;0GZtGveL6WWUuh8ZoqU4|^alvk> zrC&`eC8EsRUc9th4k(F(gTzHjaoQ=R@h>TVe&+J@>H9oS-)F3Ltakc`_#0SaDF%ncLot}?ojGZZk$tiA%$z`a+v!7XB0T(L)kM$BZ(p)D{OiqmG2;z&8+@Pu delta 415 zcmW-bO(<+}7{=enoHO&DGjnEqHmHdrjeIR8D=9`Y3&O@AMYmxy#o}7vb|VQ3h5ivK z5gLZ(CJKs?LnhQwiGH*iBxJ7SN18i zi=d+eZecn+qa*xD%j8qPX`Q}U!91eSq^`k