Start new animation for neverendingsex

This commit is contained in:
c0ffee 2024-05-16 12:30:40 -07:00
parent 41b5411c73
commit 138ac25019
3 changed files with 26 additions and 2 deletions

View File

@ -24,4 +24,30 @@ namespace Rimworld_Animations
}
}
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
public class HarmonyPatch_JobDriver_Sex2
{
public static void Postfix(JobDriver_Sex __instance, Pawn pawn)
{
//if neverending sex and pawn doesn't have an animation,
if (__instance.neverendingsex
&& __instance is JobDriver_SexBaseReciever receiverJobDriver
&& !pawn.TryGetComp<CompExtendedAnimator>().IsAnimating)
{
//start a new animation for all the pawns paired with receiver job driver
List<Pawn> participants = receiverJobDriver.parteners.Append(pawn).ToList();
GroupAnimationDef animation = AnimationUtility.FindGroupAnimation(participants, out int reorder);
if (animation != null)
{
Thing anchor = (Thing)__instance.Bed ?? pawn;
AnimationUtility.StartGroupAnimation(participants, animation, reorder, anchor);
}
}
}
}
}

View File

@ -48,8 +48,6 @@ namespace Rimworld_Animations {
participantJobDriver.orgasmStartTick = animTicks;
participantJobDriver.duration = animTicks;
}
}
}
}