using HarmonyLib; using rjw; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_Sex), "setup_ticks")] public class HarmonyPatch_JobDriver_Sex { public static void Postfix(JobDriver_Sex __instance) { if (!RJWAnimationSettings.hearts) { __instance.ticks_between_hearts = int.MaxValue; } } } [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().IsAnimating) { //start a new animation for all the pawns paired with receiver job driver List 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); } } } } }