rimworld-animations/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTrack...

32 lines
855 B
C#

using HarmonyLib;
using rjw;
using UnityEngine;
using Verse;
namespace Rimworld_Animations {
[HarmonyPatch(typeof(Pawn_DrawTracker), "DrawPos", MethodType.Getter)]
public static class HarmonyPatch_Pawn_DrawTracker {
public static bool Prefix(ref Pawn ___pawn, ref Vector3 __result) {
// If animating and is sexbaseinitiator jobdriver,
if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended
&& ___pawn.jobs?.curDriver is JobDriver_SexBaseInitiator sexdriver)
{
//align pos on top of partner
if (sexdriver?.Partner?.Drawer?.DrawPos != null)
__result = sexdriver.Partner.Drawer.DrawPos;
return false;
}
return true;
}
}
}