2024-04-16 22:10:46 +00:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using RimWorld;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace Rimworld_Animations
|
|
|
|
|
{
|
2024-04-21 00:23:31 +00:00
|
|
|
|
// Head Rotation Code - Textures
|
|
|
|
|
// it's fine to just edit each AppendRequests individually
|
|
|
|
|
// because they all the parms are passed down to each child node recursively
|
2024-04-16 22:10:46 +00:00
|
|
|
|
[HarmonyPatch(typeof(PawnRenderNode), "AppendRequests")]
|
|
|
|
|
public static class HarmonyPatch_PawnRenderNode
|
|
|
|
|
{
|
|
|
|
|
//if rendernodetag is head, update PawnDrawParms so that head, and all children, are rotated for anim
|
|
|
|
|
public static bool Prefix(ref PawnRenderNode __instance, ref PawnDrawParms parms)
|
|
|
|
|
{
|
|
|
|
|
if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
|
|
|
|
|
{
|
|
|
|
|
|
2024-04-18 22:32:31 +00:00
|
|
|
|
// ADJUST FACING get rotated textures
|
|
|
|
|
// compare the previous tick to the current tick; if the current tick rotation is different, recache
|
2024-04-19 00:40:06 +00:00
|
|
|
|
parms.facing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick);
|
2024-04-17 03:44:51 +00:00
|
|
|
|
|
2024-04-16 22:10:46 +00:00
|
|
|
|
|
2024-04-18 22:32:31 +00:00
|
|
|
|
//INVIS IF ANIM CALLS FOR IT
|
|
|
|
|
//replace maybe?
|
|
|
|
|
|
|
|
|
|
//cheaper call now comparing prev tick to cur tick
|
2024-04-21 00:23:31 +00:00
|
|
|
|
|
|
|
|
|
//not necessary because of new rendernodeworker hiding props now
|
|
|
|
|
//return extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick);
|
2024-04-18 22:32:31 +00:00
|
|
|
|
|
2024-04-16 22:10:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|