mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2026-06-19 20:05:50 +00:00
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using HarmonyLib;
|
|
using rjw;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Verse;
|
|
using Verse.AI;
|
|
|
|
namespace Rimworld_Animations
|
|
{
|
|
[HarmonyPatch(typeof(JobDriver_Masturbate), "SetupDurationTicks")]
|
|
public class HarmonyPatch_JobDriver_Masturbate
|
|
{
|
|
public static void Postfix(JobDriver_Masturbate __instance)
|
|
{
|
|
//prevent early stoppage of masturbate jobdriver during animation
|
|
|
|
/* not needed anymore? Ticks are assigned during animation
|
|
|
|
__instance.duration = 10000000;
|
|
__instance.ticks_left = __instance.duration;
|
|
|
|
*/
|
|
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(JobDriver_Masturbate), "MakeNewToils")]
|
|
public class HarmonyPatch_JobDriver_Masturbate2
|
|
{
|
|
public static void Postfix(JobDriver_Masturbate __instance, ref IEnumerable<Toil> __result)
|
|
{
|
|
|
|
var toils = __result.ToList();
|
|
|
|
//sex toil
|
|
toils[1].initAction += delegate ()
|
|
{
|
|
CompExtendedAnimator pawnAnimator = __instance.pawn.TryGetComp<CompExtendedAnimator>();
|
|
|
|
// if pawn was given an animation to play,
|
|
if (pawnAnimator.IsAnimating)
|
|
{
|
|
//set duration of masturbate toil to anim length
|
|
toils[1].defaultDuration = pawnAnimator.AnimationLength;
|
|
}
|
|
|
|
};
|
|
|
|
__result = toils.AsEnumerable();
|
|
}
|
|
}
|
|
}
|