rjw-genes/1.6/Source/HarmonyInit.cs
Telanda 59e8e2ab7e
Dev 2.7.0 Merge (#237)
* - Seperation of Animal Gene code from base RJW_Genes

* - Clean-up of leftover XML Files
- Minor update to README.md

* Fixed missing translation text
Fixed Missing B&S Undead Patch
Fixed Anal Fertility Errors, might be broken again.

DLL Included for Merge.

* - Seperation of Animal Gene code from base RJW_Genes

* - Clean-up of leftover XML Files
- Minor update to README.md

* Rework of Gene Application order for New pawns.

* Migrated Genital Genes to new Post-Sexualizeing system, removing likelyhood of Duplicates.

* Gender Fluid no longer allows sex change while pregnant.

* Fixed changes to Big & Small Lamia & Sneks Xenotype Names. (Thank you RHS0 on discord for the report!)

* Update Load order & Xenotype cleanup.

* Fix to Littered Births.
Fix to Gender Genes to make sure they only fire if active.
Version increment to 2.7

* Hormonal Saliva Gene Fixes.

* Updates to Changelog.

* DLL Commit
Fluid Production Rebalance

* Typo's fixed in CHangelog

* More Changelog Fixes
2026-07-23 16:30:18 +10:00

75 lines
No EOL
3.8 KiB
C#

using System;
using System.Linq;
using HarmonyLib;
using LLStretcher;
using RimWorld;
using rjw;
using RJWLoveFeeding;
using Verse;
namespace RJW_Genes
{
[StaticConstructorOnStartup]
internal static class HarmonyInit
{
static HarmonyInit()
{
Harmony harmony = new Harmony("rjw_genes");
var RJW_Pregnancy_Tick_Prefixes = typeof(Hediff_Pregnant).GetMethod("Tick");
harmony.Unpatch(RJW_Pregnancy_Tick_Prefixes, HarmonyPatchType.Prefix, "rjw");
harmony.PatchAll();
if (ModsConfig.BiotechActive)
{
harmony.Patch(typeof(SexUtility).GetMethod("ProcessSex"), new HarmonyMethod(typeof(LustFeeding), "Postfix", null));
}
harmony.Patch(AccessTools.Method(typeof(SexAppraiser), nameof(SexAppraiser.InMoodForRape)),
postfix: new HarmonyMethod(typeof(PatchImplants), nameof(PatchImplants.would_rape_PostFix)));
harmony.Patch(AccessTools.Method(typeof(xxx), nameof(xxx.is_rapist)),
postfix: new HarmonyMethod(typeof(PatchImplants), nameof(PatchImplants.is_rapist_PostFix)));
harmony.Patch(AccessTools.Method(typeof(AfterSexUtility), nameof(AfterSexUtility.think_about_sex_Rapist)),
postfix: new HarmonyMethod(typeof(PatchImplants), nameof(PatchImplants.think_about_sex_Rapist_PostFix)));
harmony.Patch(AccessTools.Method(typeof(PawnUtility), nameof(PawnUtility.BodyResourceGrowthSpeed)),
postfix: new HarmonyMethod(typeof(PatchImplants), nameof(PatchImplants.MultiplyPregnancy)));
harmony.Patch(AccessTools.Method(typeof(Hediff_Labor), nameof(Hediff_Labor.PostRemoved)),
postfix: new HarmonyMethod(typeof(PatchLitteredBirth), nameof(PatchLitteredBirth.Hediff_Labor_PostRemovedPostFix)));
// OvaryAgitator/Gene_LitteredBirths multibirth logic
harmony.Patch(AccessTools.Method(typeof(Hediff_LaborPushing), nameof(Hediff_LaborPushing.PostRemoved)),
postfix: new HarmonyMethod(typeof(PatchLitteredBirth), nameof(PatchLitteredBirth.Hediff_LaborPushing_PostRemovedPostFix)));
//TODO:
//1.6 quirks migrated to submod, disableing this patch for the time being.
//harmony.Patch(AccessTools.Method(typeof(Quirk), nameof(Quirk.CountSatisfiedQuirks)),
//postfix: new HarmonyMethod(typeof(QuirkPatcher), nameof(QuirkPatcher.CountSatisfiedPostfix)));
//RJW.Sexualizer.sexualize_pawn
harmony.Patch(AccessTools.Method(typeof(Sexualizer), nameof(Sexualizer.sexualize_pawn)),
//prefix: new HarmonyMethod(typeof(Patch_sexualize_pawn), nameof(Patch_sexualize_pawn.PreFix))); //Old Method that ran Sexualize early.
postfix: new HarmonyMethod(typeof(Patch_RJWSexualizer), nameof(Patch_RJWSexualizer.ApplyGenesPostfix)));
//Patch for Elastic Gene support with Eltoro's Streching mod.
if (ModsConfig.IsActive("eltoro.stretching"))
{
ModLog.Debug("Patching eltoro.Streching for elasticity gene Support.");
// This patching structure allows to patch a class that is not allways present, and a Private function that is not normaly Available.
harmony.Patch(AccessTools.Method(GenTypes.GetTypeInAnyAssembly("LLStretcher.Stretcher"), "ApplyInjuryHook"),
postfix: new HarmonyMethod(typeof(Patch_eltoro_streching), nameof(Patch_eltoro_streching.Postfix)));
// HediffComp_StretchMemory.StretchRecoveryHook
harmony.Patch(AccessTools.Method(GenTypes.GetTypeInAnyAssembly("LLStretcher.HediffComp_StretchMemory"), "StretchRecoveryHook"),
postfix: new HarmonyMethod(typeof(Patch_eltoro_strechheal), nameof(Patch_eltoro_strechheal.Postfix)));
}
}
}
}