mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
bugfix: null ref exceptions for masturbate, corpse
todo: allow anims for masturbate and corpse?
This commit is contained in:
parent
f8872b6a50
commit
d43eb0d4f9
4 changed files with 15 additions and 4 deletions
Binary file not shown.
|
@ -119,6 +119,7 @@ namespace Rimworld_Animations {
|
||||||
|
|
||||||
}
|
}
|
||||||
public override void CompTick() {
|
public override void CompTick() {
|
||||||
|
|
||||||
base.CompTick();
|
base.CompTick();
|
||||||
|
|
||||||
if(Animating) {
|
if(Animating) {
|
||||||
|
|
|
@ -21,7 +21,6 @@ namespace Rimworld_Animations {
|
||||||
RestUtility.WakeUp(pawn);
|
RestUtility.WakeUp(pawn);
|
||||||
__result = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("JoinInBedAnimation", true), partnerInMyBed, partnerInMyBed.CurrentBed());
|
__result = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("JoinInBedAnimation", true), partnerInMyBed, partnerInMyBed.CurrentBed());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,19 @@ namespace Rimworld_Animations {
|
||||||
static class HarmonyPatch_JobDriver_SexBaseInitiator_Start {
|
static class HarmonyPatch_JobDriver_SexBaseInitiator_Start {
|
||||||
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
These particular jobs need special code
|
||||||
|
don't play anim for now
|
||||||
|
*/
|
||||||
|
if(__instance is JobDriver_Masturbate_Bed || __instance is JobDriver_Masturbate_Quick || __instance is JobDriver_ViolateCorpse) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(__instance is JobDriver_JoinInBed) {
|
if(__instance is JobDriver_JoinInBed) {
|
||||||
Log.Warning("Tried to start wrong JobDriver with Rimworld-Animations installed. If you see this warning soon after installing this mod, it's fine and animated sex will start soon. If you see this a long time after installing, that's a problem.");
|
Log.Warning("Tried to start wrong JobDriver with Rimworld-Animations installed. If you see this warning soon after installing this mod, it's fine and animated sex will start soon. If you see this a long time after installing, that's a problem.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pawn Target = __instance.Target as Pawn;
|
|
||||||
Pawn pawn = __instance.pawn;
|
Pawn pawn = __instance.pawn;
|
||||||
|
|
||||||
Building_Bed bed = __instance.Bed;
|
Building_Bed bed = __instance.Bed;
|
||||||
|
@ -32,8 +39,12 @@ namespace Rimworld_Animations {
|
||||||
else if (__instance is JobDriver_SexCasualForAnimation) {
|
else if (__instance is JobDriver_SexCasualForAnimation) {
|
||||||
bed = (__instance as JobDriver_SexCasualForAnimation).Bed;
|
bed = (__instance as JobDriver_SexCasualForAnimation).Bed;
|
||||||
}
|
}
|
||||||
|
else if (__instance is JobDriver_Masturbate_Bed)
|
||||||
|
bed = (__instance as JobDriver_Masturbate_Bed).Bed;
|
||||||
|
|
||||||
if ((__instance.Target as Pawn).jobs?.curDriver is JobDriver_SexBaseReciever) {
|
if ((__instance.Target as Pawn)?.jobs?.curDriver is JobDriver_SexBaseReciever) {
|
||||||
|
|
||||||
|
Pawn Target = __instance.Target as Pawn;
|
||||||
|
|
||||||
if (!(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Contains(pawn)) {
|
if (!(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Contains(pawn)) {
|
||||||
(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Add(pawn);
|
(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Add(pawn);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue