public static Gender WhatGender(Pawn pawn) { RacePubertySetting pubertySettings = pawn.RacePubertySetting(); var intersex = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.LifeStages_Infertile_BirthDefect) != null || pubertySettings.AnyTestes(pawn) && pubertySettings.AnyWomb(pawn); if (intersex) { return(Gender.None); } var sex = pawn.gender; var cis = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.LifeStages_Transgendered) == null; if (cis) { return(sex); } switch (sex) { case Gender.Male: return(Gender.Female); case Gender.Female: return(Gender.Male); default: return(Gender.None); } }