2022-10-05 20:50:02 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using RimWorld;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Verse;
|
|
|
|
|
using Rimworld_Animations;
|
|
|
|
|
|
2022-10-25 19:38:13 +00:00
|
|
|
|
namespace Rimworld_Animations {
|
|
|
|
|
|
2022-10-05 20:50:02 +00:00
|
|
|
|
[StaticConstructorOnStartup]
|
|
|
|
|
public static class PawnWoundDrawerExtension
|
|
|
|
|
{
|
2022-10-25 19:38:13 +00:00
|
|
|
|
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())
|
2022-10-05 20:50:02 +00:00
|
|
|
|
{
|
|
|
|
|
if (pawn == null)
|
|
|
|
|
{ return; }
|
|
|
|
|
|
2022-10-25 19:38:13 +00:00
|
|
|
|
if (!flags.FlagSet(PawnRenderFlags.Portrait) && layer == PawnOverlayDrawer.OverlayLayer.Head)
|
2022-10-05 20:50:02 +00:00
|
|
|
|
{
|
|
|
|
|
CompBodyAnimator pawnAnimator = pawn.TryGetComp<CompBodyAnimator>();
|
|
|
|
|
if (pawnAnimator != null && pawnAnimator.isAnimating && pawn.Drawer.renderer.graphics.headGraphic != null)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-25 19:38:13 +00:00
|
|
|
|
pawnWoundDrawer.RenderPawnOverlay(drawLoc, bodyMesh, quat, drawNow, layer, pawnRot, overApparel);
|
2022-10-05 20:50:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-25 00:50:20 +00:00
|
|
|
|
|
2022-10-05 20:50:02 +00:00
|
|
|
|
}
|