rimworld-animations/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs

37 lines
940 B
C#

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
{
[HarmonyPatch(typeof(PawnRenderNodeWorker), "CanDrawNow")]
public class HarmonyPatch_PawnRenderTreeWorker
{
public static bool Prefix(PawnRenderNode node, ref bool __result)
{
//switching to this system so that head or body can be hidden separate from other nodes
//(hide head but not addons, etc)
//in case someone wanted to do that
if (node.AnimationWorker is AnimationWorker_KeyframesExtended animWorker)
{
if (!animWorker.visibleAtTick(node.tree.AnimationTick))
{
__result = false;
return false;
}
}
return true;
}
}
}