checking if Dyspareunia is loaded

This commit is contained in:
Stardust3D 2022-02-03 02:01:01 +01:00
parent 213aa43a04
commit ede10ab876
2 changed files with 42 additions and 12 deletions

View file

@ -10,6 +10,20 @@ namespace RJW_PlasticSurgeries
{
public abstract class Recipe_Surgery_Sphinctoplasty : Recipe_Surgery
{
private readonly bool hasDyspareunia;
public Recipe_Surgery_Sphinctoplasty()
{
try
{
hasDyspareunia = Type.GetType("Dyspareunia.PenetrationUtility").ToString() != null;
}
catch (Exception e)
{
hasDyspareunia = false;
}
}
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{
var part = Genital_Helper.get_anusBPR(pawn);
@ -38,16 +52,17 @@ namespace RJW_PlasticSurgeries
pawn.GetAnusList().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_Sphinctoplasty_Micro : Recipe_Surgery_Sphinctoplasty

View file

@ -10,6 +10,20 @@ namespace RJW_PlasticSurgeries
{
public abstract class Recipe_Surgery_Vaginoplasty : Recipe_Surgery
{
private readonly bool hasDyspareunia;
public Recipe_Surgery_Vaginoplasty()
{
try
{
hasDyspareunia = Type.GetType("Dyspareunia.PenetrationUtility").ToString() != null;
}
catch (Exception e)
{
hasDyspareunia = false;
}
}
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{
var part = Genital_Helper.get_genitalsBPR(pawn);
@ -38,16 +52,17 @@ namespace RJW_PlasticSurgeries
pawn.GetGenitalsList().FindAll(Genital_Helper.is_vagina).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_Vaginoplasty_Micro : Recipe_Surgery_Vaginoplasty