mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using RimWorld;
|
|
using UnityEngine;
|
|
using Verse;
|
|
|
|
namespace Rimworld_Animations {
|
|
|
|
[StaticConstructorOnStartup]
|
|
public static class PawnWoundDrawerExtension
|
|
{
|
|
public static void RenderPawnOverlay(this PawnWoundDrawer pawnWoundDrawer, Vector3 drawLoc, Mesh bodyMesh, Quaternion quat, bool drawNow, PawnOverlayDrawer.OverlayLayer layer, Rot4 pawnRot, bool? overApparel = null, Pawn pawn = null, PawnRenderFlags flags = new PawnRenderFlags())
|
|
{
|
|
if (pawn == null)
|
|
{ return; }
|
|
|
|
if (!flags.FlagSet(PawnRenderFlags.Portrait) && layer == PawnOverlayDrawer.OverlayLayer.Head)
|
|
{
|
|
if (CompBodyAnimator.IsAnimating(pawn) && pawn.Drawer.renderer.graphics.headGraphic != null)
|
|
{
|
|
CompBodyAnimator pawnAnimator = pawn.TryGetComp<CompBodyAnimator>();
|
|
pawnRot = pawnAnimator.headFacing;
|
|
quat = Quaternion.AngleAxis(angle: pawnAnimator.headAngle, axis: Vector3.up);
|
|
float y = drawLoc.y;
|
|
drawLoc = pawnAnimator.getPawnHeadPosition() - Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up) * pawn.Drawer.renderer.BaseHeadOffsetAt(pawnAnimator.headFacing);
|
|
drawLoc.y = y;
|
|
}
|
|
}
|
|
|
|
pawnWoundDrawer.RenderPawnOverlay(drawLoc, bodyMesh, quat, drawNow, layer, pawnRot, overApparel);
|
|
}
|
|
}
|
|
|
|
}
|