mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
41 lines
No EOL
1.9 KiB
C#
41 lines
No EOL
1.9 KiB
C#
using Verse;
|
|
using HarmonyLib;
|
|
using System;
|
|
|
|
namespace RJW_Genes
|
|
{
|
|
[StaticConstructorOnStartup]
|
|
internal static class HarmonyInit
|
|
{
|
|
static HarmonyInit()
|
|
{
|
|
Harmony harmony = new Harmony("rjw_genes");
|
|
harmony.PatchAll();
|
|
|
|
// Patch Licentia, if Licentia exists
|
|
// Logic & Explanation taken from https://rimworldwiki.com/wiki/Modding_Tutorials/Compatibility_with_DLLs
|
|
// Adjusted to use ModsConfig (which makes it work, the example above does not run out of the box)
|
|
try
|
|
{
|
|
((Action)(() =>
|
|
{
|
|
if (ModsConfig.IsActive("LustLicentia.RJWLabs"))
|
|
{
|
|
// Gene: Cumflation Immunity [Prefix Patch]
|
|
harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.Cumflation)),
|
|
prefix: new HarmonyMethod(typeof(Patch_Cumflation), nameof(Patch_Cumflation.Prefix)));
|
|
// Gene: Generous Donor [Postfix Patch]
|
|
harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.TransferNutrition)),
|
|
postfix: new HarmonyMethod(typeof(Patch_TransferNutrition), nameof(Patch_TransferNutrition.Postfix)));
|
|
// Gene: CumEater [Postfix Patch]
|
|
harmony.Patch(AccessTools.Method(typeof(rjw.JobDriver_Sex), nameof(rjw.JobDriver_Sex.ChangePsyfocus)),
|
|
postfix: new HarmonyMethod(typeof(Patch_SexTicks_ChangePsyfocus), nameof(Patch_SexTicks_ChangePsyfocus.Postfix)));
|
|
}
|
|
}))();
|
|
}
|
|
catch (TypeLoadException ex) {
|
|
// To be expected for people without Licentia Labs
|
|
}
|
|
}
|
|
}
|
|
} |