public static void add_breasts(Pawn pawn, Pawn parent = null, Gender gender = Gender.None) { //--Log.Message("[RJW] add_breasts( " + xxx.get_pawnname(pawn) + " ) called"); BodyPartRecord partBPR = Genital_Helper.get_breastsBPR(pawn); if (partBPR == null) { //--Log.Message("[RJW] add_breasts( " + xxx.get_pawnname(pawn) + " ) - pawn doesn't have a breasts"); return; } else if (pawn.health.hediffSet.PartIsMissing(partBPR)) { //--Log.Message("[RJW] add_breasts( " + xxx.get_pawnname(pawn) + " ) had breasts but were removed."); return; } if (Genital_Helper.has_breasts(pawn)) { //--Log.Message("[RJW] add_breasts( " + xxx.get_pawnname(pawn) + " ) - pawn already has breasts"); return; } //TODO: figure out how to add (flat) breasts to males var racePartType = (pawn.gender == Gender.Female || gender == Gender.Female) ? SexPartType.FemaleBreast : SexPartType.MaleBreast; if (pawn.TryAddRacePart(racePartType)) { return; } LegacySexPartAdder.AddBreasts(pawn, partBPR, parent); }
public static void UpdateBoobitis(Pawn pawn) { var hediff = std.get_infection(pawn, std.boobitis); if (hediff == null || !(hediff.Severity >= 0.20f) || hediff.FullyImmune() || !BreastSize_Helper.TryGetBreastSize(pawn, out var oldSize, out var oldBoobs) || oldSize >= BreastSize_Helper.MaxSize || !RollFor(hediff.Severity > 0.90f ? 5f : 15f)) { return; } var chest = Genital_Helper.get_breastsBPR(pawn); var newSize = oldSize + 1; var newBoobs = BreastSize_Helper.GetHediffDef(newSize); GenderHelper.ChangeSex(pawn, () => { if (oldBoobs != null) { pawn.health.RemoveHediff(oldBoobs); } pawn.health.AddHediff(newBoobs, chest); }); var message = "RJW_BreastsHaveGrownFromBoobitis".Translate(pawn); Messages.Message(message, pawn, MessageTypeDefOf.SilentInput); }
/// <summary> /// Returns true and sets size and hediff if pawn has natural breasts. /// Hediff will still be null for nipples only. /// Otherwise returns false. /// </summary> public static bool TryGetBreastSize(Pawn pawn, out int size, out Hediff hediff) { var chest = Genital_Helper.get_breastsBPR(pawn); if (pawn.health.hediffSet.PartIsMissing(chest)) { size = 0; hediff = null; return(false); } foreach (var candidate_hediff in pawn.health.hediffSet.hediffs) { if (SizeByHediffDef.TryGetValue(candidate_hediff.def, out size)) { hediff = candidate_hediff; return(true); } } if (HasNipplesOnly(pawn, chest)) { size = NipplesOnlyBreastSize; hediff = null; return(true); } size = 0; hediff = null; return(false); }
public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipeDef) { yield break; var chest = Genital_Helper.get_breastsBPR(pawn); if (Genital_Helper.breasts_blocked(pawn)) { yield break; } if (BreastSize_Helper.TryGetBreastSize(pawn, out var size) //&& size > BreastSize_Helper.GetSize(Genital_Helper.flat_breasts)) ) { yield return(chest); } }
public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipeDef) { yield break; var chest = Genital_Helper.get_breastsBPR(pawn); if (pawn.health.hediffSet.PartIsMissing(chest) || Genital_Helper.breasts_blocked(pawn)) { yield break; } var old = recipeDef.removesHediff; if (old == null ? BreastSize_Helper.HasNipplesOnly(pawn, chest) : pawn.health.hediffSet.HasHediff(old, chest)) { yield return(chest); } }