tweaks for potential null ref. check errors

This commit is contained in:
Platinum 2020-07-18 10:30:56 -07:00
parent 3733c1caa4
commit ab3a87bb5f
4 changed files with 7 additions and 5 deletions

View File

@ -46,7 +46,7 @@
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\RJW\1.1\Assemblies\RJW.dll</HintPath>
<HintPath>..\rjw-master\1.1\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />

View File

@ -45,7 +45,7 @@ namespace Rimworld_Animations {
private float clipPercent = 0;
public Vector3 anchor, deltaPos, headBob;
public float bodyAngle, headAngle, genitalAngle;
public float bodyAngle, headAngle, genitalAngle = 0;
public Rot4 headFacing, bodyFacing;
public bool controlGenitalAngle = false;

View File

@ -77,8 +77,10 @@ namespace Rimworld_Animations {
Vector2 bodyOffset = ((!portrait) ? offset?.bodyTypes : (offset?.portraitBodyTypes ?? offset?.bodyTypes))?.FirstOrDefault((AlienPartGenerator.BodyTypeOffset to) => to.bodyType == pawn.story.bodyType)?.offset ?? Vector2.zero;
Vector2 crownOffset = ((!portrait) ? offset?.crownTypes : (offset?.portraitCrownTypes ?? offset?.crownTypes))?.FirstOrDefault((AlienPartGenerator.CrownTypeOffset to) => to.crownType == alienComp.crownType)?.offset ?? Vector2.zero;
Vector2 bodyOffset = (portrait ? offset?.portraitBodyTypes ?? offset?.bodyTypes : offset?.bodyTypes)?.FirstOrDefault(predicate: to => to.bodyType == pawn.story.bodyType)
?.offset ?? Vector2.zero;
Vector2 crownOffset = (portrait ? offset?.portraitCrownTypes ?? offset?.crownTypes : offset?.crownTypes)?.FirstOrDefault(predicate: to => to.crownType == alienComp.crownType)
?.offset ?? Vector2.zero;
//Defaults for tails
//south 0.42f, -0.3f, -0.22f
@ -127,7 +129,7 @@ namespace Rimworld_Animations {
else {
Quaternion addonRotation = quat;
if (AnimationSettings.controlGenitalRotation && pawnAnimator.controlGenitalAngle && ba.hediffGraphics[0] != null && (ba.hediffGraphics[0].path.Contains("Penis") || ba.hediffGraphics[0].path.Contains("penis"))) {
if (AnimationSettings.controlGenitalRotation && pawnAnimator.controlGenitalAngle && ba.hediffGraphics[0]?.path != null && (ba.hediffGraphics[0].path.Contains("Penis") || ba.hediffGraphics[0].path.Contains("penis"))) {
addonRotation = Quaternion.AngleAxis(angle: pawnAnimator.genitalAngle, axis: Vector3.up);
}