public override PawnGenerationRequest Notify_PawnGenerationRequest(PawnGenerationRequest req) { if (req.FixedGender.HasValue) { return(req); } if (!Rand.Chance(chance)) { return(req); } Gender?g = gender == PawnModifierGender.Female ? Gender.Female : Gender.Male; bool isPlayerFaction = req.Faction?.IsPlayer ?? false; switch (context) { case PawnModifierContext.All: return(req.WithProperty(nameof(PawnGenerationRequest.FixedGender), g)); case PawnModifierContext.Player when isPlayerFaction: return(req.WithProperty(nameof(PawnGenerationRequest.FixedGender), g)); case PawnModifierContext.NonPlayer when !isPlayerFaction: return(req.WithProperty(nameof(PawnGenerationRequest.FixedGender), g)); case PawnModifierContext.Faction when faction == req.Faction.def: return(req.WithProperty(nameof(PawnGenerationRequest.FixedGender), g)); case PawnModifierContext.PlayerStarter when req.Context == PawnGenerationContext.PlayerStarter: return(req.WithProperty(nameof(PawnGenerationRequest.FixedGender), g)); } return(req); }