mirror of
https://gitgud.io/Stardust3D/rjw-plasticsurgeries.git
synced 2024-08-14 23:57:25 +00:00
1.5 compatibility by removing incompatible code and libraries
This commit is contained in:
parent
476213ed08
commit
95263ed0e0
8 changed files with 141 additions and 10 deletions
61
Source/RJW_PlasticSurgeries/1.5/Recipe_Plastic_Surgery.cs
Normal file
61
Source/RJW_PlasticSurgeries/1.5/Recipe_Plastic_Surgery.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using System.Collections.Generic;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_PlasticSurgeries
|
||||
{
|
||||
public abstract class Recipe_Plastic_Surgery : Recipe_Surgery
|
||||
{
|
||||
protected readonly bool HasDyspareunia = ModLister.HasActiveModWithName("Dyspareunia");
|
||||
protected readonly bool HasLicentia = ModLister.HasActiveModWithName("RimJobWorld - Licentia Labs");
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/// <Compatibility />
|
||||
private static void DamageHediff(Hediff hed)
|
||||
{
|
||||
}
|
||||
|
||||
protected void SurgeryX(Pawn pawn, float severity, bool damagePart = false)
|
||||
{
|
||||
GetHediffs(pawn).ForEach(hed =>
|
||||
{
|
||||
hed.Severity = severity;
|
||||
if (damagePart && HasDyspareunia) DamageHediff(hed);
|
||||
if (damagePart && HasLicentia)
|
||||
{
|
||||
var (type, damage) = GetLicentiaDamage();
|
||||
LicentiaLabs.DamageHelper.ApplyDamage(pawn, hed.Part, type, damage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract List<Hediff> GetHediffs(Pawn pawn);
|
||||
protected abstract (HediffDef, float) GetLicentiaDamage();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue