mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
null ref checks in case of missing comps
This commit is contained in:
parent
36caeeda7e
commit
a84d6f6a6d
2 changed files with 13 additions and 5 deletions
Binary file not shown.
|
@ -19,7 +19,7 @@ namespace Rimworld_Animations {
|
|||
{
|
||||
|
||||
CompBodyAnimator pawnAnimator = pawn.TryGetComp<CompBodyAnimator>();
|
||||
if (!renderFlags.FlagSet(PawnRenderFlags.Portrait) && pawnAnimator.isAnimating && (bodyAddon.drawnInBed || bodyAddon.alignWithHead))
|
||||
if (pawnAnimator != null && !renderFlags.FlagSet(PawnRenderFlags.Portrait) && pawnAnimator.isAnimating && (bodyAddon.drawnInBed || bodyAddon.alignWithHead))
|
||||
{
|
||||
|
||||
Quaternion headQuatInAnimation = Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up);
|
||||
|
@ -67,16 +67,24 @@ namespace Rimworld_Animations {
|
|||
{
|
||||
yield return ins[i];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Prefix(PawnRenderFlags renderFlags, ref Vector3 vector, ref Vector3 headOffset, Pawn pawn, ref Quaternion quat, ref Rot4 rotation)
|
||||
{
|
||||
if(pawn == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
CompBodyAnimator anim = pawn.TryGetComp<CompBodyAnimator>();
|
||||
if (!renderFlags.FlagSet(PawnRenderFlags.Portrait) && anim.isAnimating)
|
||||
|
||||
if(anim == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (anim != null && !renderFlags.FlagSet(PawnRenderFlags.Portrait) && anim.isAnimating)
|
||||
{
|
||||
quat = Quaternion.AngleAxis(anim.bodyAngle, Vector3.up);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue