From 2e89759a9a2bd44f5af51f084671765ce2cddbea Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sat, 21 May 2022 21:33:31 +0200 Subject: [PATCH] WIP for SexConversions --- .../Ideology/Patches/RJW_Patch.cs | 41 +++++++++++++++++++ RJWSexperience/IdeologyAddon/VariousDefOf.cs | 2 + .../PreceptDefs/Precepts_SexProselytizing.xml | 31 ++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch.cs create mode 100644 RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_SexProselytizing.xml diff --git a/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch.cs b/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch.cs new file mode 100644 index 0000000..76431e7 --- /dev/null +++ b/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch.cs @@ -0,0 +1,41 @@ +using HarmonyLib; +using RimWorld; +using rjw; +using System; +using Verse; + +namespace RJWSexperience.Ideology +{ + /* + [HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")] + public static class RJW_Patch_Orgasm_IdeoConversion + { + public static void Postfix(JobDriver_Sex __instance) + { + // ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation) + if (__instance.pawn == null || __instance.Partner == null) + return; + // Orgasm is called "all the time" - it exits early when the sex is still going. + // Hence, we exit early if there is no actual orgasm happening + if (__instance.sex_ticks > __instance.orgasmstick) + return; + + if (__instance.pawn.Ideo.HasPrecept(VariousDefOf.Proselyzing_By_Orgasm)) + { + IdeoUtility.ConvertPawnBySex(__instance.pawn, __instance.Partner); + } + } + } + + [HarmonyPatch(typeof(SexUtility), "Aftersex", new Type[] { typeof(SexProps) })] + public static class RJW_Patch_Aftersex_IdeoConversion + { + // This is not exactly where I should put it (Maybe after The JobDriver_Sex Finishes??) + // But it works here and doesn't damage things. + public static void Postfix(SexProps props) + { + + } + } + */ +} diff --git a/RJWSexperience/IdeologyAddon/VariousDefOf.cs b/RJWSexperience/IdeologyAddon/VariousDefOf.cs index a8b11d5..e4a6add 100644 --- a/RJWSexperience/IdeologyAddon/VariousDefOf.cs +++ b/RJWSexperience/IdeologyAddon/VariousDefOf.cs @@ -72,5 +72,7 @@ namespace RJWSexperience.Ideology [MayRequireIdeology] public static readonly PreceptDef Necrophilia_Disapproved = DefDatabase.GetNamed("Necrophilia_Disapproved"); [MayRequireIdeology] public static readonly PreceptDef Necrophilia_Acceptable = DefDatabase.GetNamed("Necrophilia_Acceptable"); [MayRequireIdeology] public static readonly PreceptDef Necrophilia_Approved = DefDatabase.GetNamed("Necrophilia_Approved"); + [MayRequireIdeology] public static readonly PreceptDef Proselyzing_By_Orgasm = DefDatabase.GetNamed("Proselyzing_By_Orgasm"); + [MayRequireIdeology] public static readonly PreceptDef Proselyzing_By_Sex = DefDatabase.GetNamed("Proselyzing_By_Sex"); } } diff --git a/RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_SexProselytizing.xml b/RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_SexProselytizing.xml new file mode 100644 index 0000000..baee52b --- /dev/null +++ b/RJWSexperience_Ideology/Defs/PreceptDefs/Precepts_SexProselytizing.xml @@ -0,0 +1,31 @@ + + + + + + Sex_Proselytizing + + UI/Issues/Submissive + + + + Proselyzing_By_Sex + Sex_Proselytizing + + Sex converts both partners towards this ideology. + Low + 40 + 300 + + + + Proselyzing_By_Orgasm + Sex_Proselytizing + + Orgasms converts both partners towards this ideology. + Low + 50 + 400 + + + \ No newline at end of file