rjw-genes/1.6/Source/Genes/Patches/Patch_eltoro_streching.cs
Telanda-DDS 5025700727 - Fixed potential null varaible exception in ElToro Stretching patch.
- Fixed Orgasm Rush not triggering when partner was an Animal.
2025-08-03 12:06:16 +10:00

57 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using HarmonyLib;
namespace RJW_Genes
{
public class Patch_eltoro_streching
{
/// <summary>
/// Patch function that connects to Strecher.ApplyInjury, itercepting the creation of injury hediffs, and preventing if a Gene would stop the injury.
/// </summary>
/// <param name="pawn"></param>
/// <param name="part"></param>
/// <param name="def"></param>
/// <param name="severity"></param>
/// <returns></returns>
public static void Postfix(Pawn pawn, BodyPartRecord part, HediffDef def, float severity, ref bool __result)
{
if (pawn?.genes?.HasActiveGene(GeneDefOf.rjw_genes_elasticity) ?? false)
{
ModLog.Debug($"Preventing creation of Injury Hediffs from streching for pawn {pawn.Name}.");
__result = false;
return;
}
else
{
return;
}
}
}
public class Patch_eltoro_strechheal
{
/// <summary>
/// Patch function that connects to Strecher.ApplyInjury, itercepting the creation of injury hediffs, and preventing if a Gene would stop the injury.
/// </summary>
/// <returns></returns>
public static void Postfix(ref HediffComp __instance, ref float __result)
{
if (__instance.Pawn?.genes?.HasActiveGene(GeneDefOf.rjw_genes_elasticity) ?? false)
{
ModLog.Debug($"Healing streching factor @ x2 speed for pawn : {__instance.Pawn.Name}.");
__result = 2f;
} else
{
return;
}
}
}
}