mirror of
				https://gitgud.io/Stardust3D/rjw-plasticsurgeries.git
				synced 2024-08-14 23:57:25 +00:00 
			
		
		
		
	checking if Dyspareunia is loaded
This commit is contained in:
		
							parent
							
								
									213aa43a04
								
							
						
					
					
						commit
						ede10ab876
					
				
					 2 changed files with 42 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue