mirror of
https://gitgud.io/Stardust3D/rjw-plasticsurgeries.git
synced 2024-08-14 23:57:25 +00:00
moved most surgery logic into Recipe_Plastic_Surgery.cs
This commit is contained in:
parent
69d9346ee5
commit
94711f740a
6 changed files with 227 additions and 183 deletions
55
Source/RJW_PlasticSurgeries/Recipe_Plastic_Surgery.cs
Normal file
55
Source/RJW_PlasticSurgeries/Recipe_Plastic_Surgery.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System.Collections.Generic;
|
||||
using Dyspareunia;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using Verse;
|
||||
using DamageDefOf = Dyspareunia.DamageDefOf;
|
||||
|
||||
namespace RJW_PlasticSurgeries
|
||||
{
|
||||
public abstract class Recipe_Plastic_Surgery : Recipe_Surgery
|
||||
{
|
||||
protected readonly bool HasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
|
||||
|
||||
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||
{
|
||||
var part = GetPartCandidate(pawn);
|
||||
if (part != null)
|
||||
{
|
||||
var hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
|
||||
if (HasPart(pawn, hediffs)) yield return part;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract BodyPartRecord GetPartCandidate(Pawn pawn);
|
||||
protected abstract bool HasPart(Pawn pawn, List<Hediff> hediffs);
|
||||
|
||||
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients,
|
||||
Bill bill)
|
||||
{
|
||||
if (billDoer != null)
|
||||
{
|
||||
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
|
||||
SurgeryResult(pawn);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void SurgeryResult(Pawn pawn);
|
||||
|
||||
private static void DamageHediff(Hediff hed)
|
||||
{
|
||||
PenetrationUtility.AddDamageHediff(DamageDefOf.SexStretch, 0.5f, hed, null);
|
||||
}
|
||||
|
||||
protected void SurgeryX(Pawn pawn, float severity, bool useDyspareunia = false)
|
||||
{
|
||||
GetHediffs(pawn).ForEach(hed =>
|
||||
{
|
||||
hed.Severity = severity;
|
||||
if (useDyspareunia && HasDyspareunia) DamageHediff(hed);
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract List<Hediff> GetHediffs(Pawn pawn);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue