From 69d9346ee566b20be3947204fd313c83411c8e4c Mon Sep 17 00:00:00 2001 From: Stardust3D <3dstardust@gmail.com> Date: Wed, 19 Oct 2022 17:51:28 +0200 Subject: [PATCH] added Dyspareunia check to Penoplasty --- .../Recipe_Surgery_Penoplasty.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/RJW_PlasticSurgeries/Recipe_Surgery_Penoplasty.cs b/Source/RJW_PlasticSurgeries/Recipe_Surgery_Penoplasty.cs index 0234026..5d39898 100644 --- a/Source/RJW_PlasticSurgeries/Recipe_Surgery_Penoplasty.cs +++ b/Source/RJW_PlasticSurgeries/Recipe_Surgery_Penoplasty.cs @@ -10,6 +10,8 @@ namespace RJW_PlasticSurgeries { public abstract class Recipe_Surgery_Penoplasty : Recipe_Surgery { + private readonly bool hasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia"); + public override IEnumerable GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { var part = Genital_Helper.get_genitalsBPR(pawn); @@ -39,16 +41,17 @@ namespace RJW_PlasticSurgeries pawn.GetGenitalsList().FindAll(Genital_Helper.is_penis).ForEach(hed => { hed.Severity = severity; - try + if (hasDyspareunia) { - PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null); - } - catch (Exception e) - { - Log.Error("Try enabling Dyspareunia for sore genitals"); + DamageHediff(hed); } }); } + + private static void DamageHediff(Hediff hed) + { + PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null); + } } public class Recipe_Surgery_Penoplasty_Micro : Recipe_Surgery_Penoplasty