﻿using HarmonyLib;
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 (CompBodyAnimator.IsAnimating(___pawn)) {
                CompBodyAnimator bodyAnim = ___pawn.TryGetComp<CompBodyAnimator>();
                __result = bodyAnim.anchor + bodyAnim.deltaPos;

                return false;
            }
            return true;
        }
    }
}
