mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Upload New File
This commit is contained in:
parent
9f9fb16cf3
commit
aeceb77100
1 changed files with 34 additions and 0 deletions
34
1.3/Source/Extensions/PawnWoundDrawerExtension.cs
Normal file
34
1.3/Source/Extensions/PawnWoundDrawerExtension.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using RimWorld;
|
||||||
|
using UnityEngine;
|
||||||
|
using Verse;
|
||||||
|
using Rimworld_Animations;
|
||||||
|
|
||||||
|
namespace Rimworld_Animations
|
||||||
|
{
|
||||||
|
[StaticConstructorOnStartup]
|
||||||
|
public static class PawnWoundDrawerExtension
|
||||||
|
{
|
||||||
|
public static void RenderOverBody(this PawnWoundDrawer pawnWoundDrawer, Vector3 drawLoc, Mesh bodyMesh, Quaternion quat, bool drawNow, BodyTypeDef.WoundLayer layer, Rot4 pawnRot, bool? overApparel = null, Pawn pawn = null, PawnRenderFlags flags = new PawnRenderFlags())
|
||||||
|
{
|
||||||
|
if (pawn == null)
|
||||||
|
{ return; }
|
||||||
|
|
||||||
|
if (!flags.FlagSet(PawnRenderFlags.Portrait) && layer == BodyTypeDef.WoundLayer.Head)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pawnWoundDrawer.RenderOverBody(drawLoc, bodyMesh, quat, drawNow, layer, pawnRot, overApparel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue