RJW can move breasts on some animals, and that seems to make the breast comp properties null, so test for that.

This commit is contained in:
lutepickle 2022-08-11 14:31:37 -07:00
parent 9ce08ceab8
commit 26ff5f3d6c
3 changed files with 4 additions and 2 deletions

Binary file not shown.

View file

@ -10,6 +10,7 @@ namespace RJW_Menstruation
{
public class CompProperties_Breast : HediffCompProperties
{
public static readonly ColorInt DefaultBlacknippleColor = new ColorInt(55, 20, 0);
public string BreastTex = "Breasts/Breast";
public ColorInt BlacknippleColor = new ColorInt(55, 20, 0);
@ -349,7 +350,8 @@ namespace RJW_Menstruation
cachedAreola = baseAreola + nippleProgress * nippleChange;
cachedNipple = baseNipple + nippleProgress * nippleChange;
cachedColor = Colors.CMYKLerp(parent.pawn.story?.SkinColor ?? Color.white, Props.BlackNippleColor, Alpha);
// For some reason, Props can go null when RJW relocates the chest (e.g. some animals), so catch that
cachedColor = Colors.CMYKLerp(parent.pawn.story?.SkinColor ?? Color.white, (Props?.BlackNippleColor ?? CompProperties_Breast.DefaultBlacknippleColor.ToColor), Alpha);
}
public void CopyBreastProperties(HediffComp_Breast original)

View file

@ -167,7 +167,7 @@ namespace RJW_Menstruation
{
HediffComp_Breast comp = hediff.TryGetComp<HediffComp_Breast>();
string icon;
if (comp != null) icon = comp.Props.BreastTex ?? "Breasts/Breast_Breast";
if (comp != null) icon = comp.Props?.BreastTex ?? "Breasts/Breast_Breast";
else
{
breast = ContentFinder<Texture2D>.Get("Breasts/Breast_Breast00", false);