added Dyspareunia check to Penoplasty

This commit is contained in:
Stardust3D 2022-10-19 17:51:28 +02:00
parent 34f3fca011
commit 69d9346ee5
1 changed files with 9 additions and 6 deletions

View File

@ -10,6 +10,8 @@ namespace RJW_PlasticSurgeries
{ {
public abstract class Recipe_Surgery_Penoplasty : Recipe_Surgery public abstract class Recipe_Surgery_Penoplasty : Recipe_Surgery
{ {
private readonly bool hasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{ {
var part = Genital_Helper.get_genitalsBPR(pawn); var part = Genital_Helper.get_genitalsBPR(pawn);
@ -39,16 +41,17 @@ namespace RJW_PlasticSurgeries
pawn.GetGenitalsList().FindAll(Genital_Helper.is_penis).ForEach(hed => pawn.GetGenitalsList().FindAll(Genital_Helper.is_penis).ForEach(hed =>
{ {
hed.Severity = severity; hed.Severity = severity;
try if (hasDyspareunia)
{ {
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null); DamageHediff(hed);
}
catch (Exception e)
{
Log.Error("Try enabling Dyspareunia for sore genitals");
} }
}); });
} }
private static void DamageHediff(Hediff hed)
{
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null);
}
} }
public class Recipe_Surgery_Penoplasty_Micro : Recipe_Surgery_Penoplasty public class Recipe_Surgery_Penoplasty_Micro : Recipe_Surgery_Penoplasty