From 68be7aed6f8f3dbd7c7fa00de61da83b25a81113 Mon Sep 17 00:00:00 2001 From: klassekatze Date: Fri, 30 Dec 2022 00:05:53 -0500 Subject: [PATCH 01/13] patches in some of these genes to biotech nyaron, narai, papou, saurid if they are present; also a template for doing the same with any other mod xenotypes I guess --- Common/Patches/Xenotypes/PatchBiotechNyaron.xml | 14 ++++++++++++++ Common/Patches/Xenotypes/PatchNarai.xml | 15 +++++++++++++++ Common/Patches/Xenotypes/PatchPapou.xml | 17 +++++++++++++++++ Common/Patches/Xenotypes/PatchSaurid.xml | 14 ++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 Common/Patches/Xenotypes/PatchBiotechNyaron.xml create mode 100644 Common/Patches/Xenotypes/PatchNarai.xml create mode 100644 Common/Patches/Xenotypes/PatchPapou.xml create mode 100644 Common/Patches/Xenotypes/PatchSaurid.xml diff --git a/Common/Patches/Xenotypes/PatchBiotechNyaron.xml b/Common/Patches/Xenotypes/PatchBiotechNyaron.xml new file mode 100644 index 0000000..50ad15f --- /dev/null +++ b/Common/Patches/Xenotypes/PatchBiotechNyaron.xml @@ -0,0 +1,14 @@ + + + + +
  • Biotech Nyaron
  • +
    + + Defs/XenotypeDef[defName="Nyaron"]/genes + +
  • rjw_genes_feline_genitalia
  • +
    +
    +
    +
    \ No newline at end of file diff --git a/Common/Patches/Xenotypes/PatchNarai.xml b/Common/Patches/Xenotypes/PatchNarai.xml new file mode 100644 index 0000000..51ee9d8 --- /dev/null +++ b/Common/Patches/Xenotypes/PatchNarai.xml @@ -0,0 +1,15 @@ + + + + +
  • NaraiXenotype
  • +
    + + Defs/XenotypeDef[defName="Narai"]/genes + +
  • rjw_genes_canine_genitalia
  • +
  • rjw_genes_zoophile
  • +
    +
    +
    +
    \ No newline at end of file diff --git a/Common/Patches/Xenotypes/PatchPapou.xml b/Common/Patches/Xenotypes/PatchPapou.xml new file mode 100644 index 0000000..2fbd66b --- /dev/null +++ b/Common/Patches/Xenotypes/PatchPapou.xml @@ -0,0 +1,17 @@ + + + + +
  • Papou Race : emotional birds
  • +
    + + Defs/XenotypeDef[defName="papago"]/genes + +
  • rjw_genes_orgasm_rush
  • +
  • rjw_genes_damage
  • +
  • rjw_genes_tight_female_genitalia
  • +
  • rjw_genes_tight_anus
  • +
    +
    +
    +
    \ No newline at end of file diff --git a/Common/Patches/Xenotypes/PatchSaurid.xml b/Common/Patches/Xenotypes/PatchSaurid.xml new file mode 100644 index 0000000..c1fd626 --- /dev/null +++ b/Common/Patches/Xenotypes/PatchSaurid.xml @@ -0,0 +1,14 @@ + + + + +
  • Vanilla Races Expanded - Saurid
  • +
    + + Defs/XenotypeDef[defName="VRESaurids_Saurid"]/genes + +
  • rjw_genes_dragon_genitalia
  • +
    +
    +
    +
    \ No newline at end of file From be36025325682d6c12e61e39ade7bcc20fbfb578 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Fri, 6 Jan 2023 08:36:54 +0100 Subject: [PATCH 02/13] Conditional Addition of RJW Genes to Base Xenotypes when Licentia is present, fixes #5 --- Common/Patches/Xenotypes/GenitaliaUpdate.xml | 51 +++++--------------- 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/Common/Patches/Xenotypes/GenitaliaUpdate.xml b/Common/Patches/Xenotypes/GenitaliaUpdate.xml index f0af1b5..0a1f3e9 100644 --- a/Common/Patches/Xenotypes/GenitaliaUpdate.xml +++ b/Common/Patches/Xenotypes/GenitaliaUpdate.xml @@ -1,44 +1,6 @@ - - - Defs/XenotypeDef[defName="Neanderthal"]/genes @@ -74,8 +36,21 @@ Defs/XenotypeDef[defName="Highmate"]/genes
  • rjw_genes_hypersexual
  • +
    +
    + + + + +
  • LustLicentia.RJWLabs
  • +
    + + Defs/XenotypeDef[defName="Highmate"]/genes +
  • rjw_genes_likes_cumflation
  • +
    From aad8efa04e2a4612acbf5985569f333397adf363 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Fri, 6 Jan 2023 09:45:03 +0100 Subject: [PATCH 03/13] Orgasm Rush now adds a hediff --- Common/Defs/HediffDefs/Hediffs_OrgasmRush.xml | 78 +++++++++++++++++++ Source/GeneDefOf.cs | 2 + Source/Genes/Special/Patch_OrgasmRush.cs | 34 +++++++- Source/Rjw-Genes.csproj | 14 ++-- 4 files changed, 119 insertions(+), 9 deletions(-) create mode 100644 Common/Defs/HediffDefs/Hediffs_OrgasmRush.xml diff --git a/Common/Defs/HediffDefs/Hediffs_OrgasmRush.xml b/Common/Defs/HediffDefs/Hediffs_OrgasmRush.xml new file mode 100644 index 0000000..f68663f --- /dev/null +++ b/Common/Defs/HediffDefs/Hediffs_OrgasmRush.xml @@ -0,0 +1,78 @@ + + + + + rjw_genes_orgasm_rush_hediff + HediffWithComps + + Xenotypes with this Gene are pushed beyond normal limits when they have an orgasm. + (240,200,110) + false + 1.0 + false + false + +
  • + -0.75 +
  • +
    + +
  • + + + 4 + 4 + + +
  • + Consciousness + 0.05 +
  • + + +
  • + + 0.4 + + 8 + 8 + + +
  • + Moving + 0.08 +
  • +
  • + Consciousness + 0.08 +
  • + + +
  • + + 0.7 + + 10 + 10 + + +
  • + Moving + 0.1 +
  • +
  • + Consciousness + 0.1 +
  • +
  • + BloodPumping + 0.1 +
  • + + + +
    +
    + +
    + diff --git a/Source/GeneDefOf.cs b/Source/GeneDefOf.cs index 744eb11..631602f 100644 --- a/Source/GeneDefOf.cs +++ b/Source/GeneDefOf.cs @@ -71,5 +71,7 @@ namespace RJW_Genes // Special public static readonly GeneDef rjw_genes_orgasm_rush; + + public static readonly HediffDef rjw_genes_orgasm_rush_hediff; } } diff --git a/Source/Genes/Special/Patch_OrgasmRush.cs b/Source/Genes/Special/Patch_OrgasmRush.cs index 0b881f2..fefcb7a 100644 --- a/Source/Genes/Special/Patch_OrgasmRush.cs +++ b/Source/Genes/Special/Patch_OrgasmRush.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Verse; namespace RJW_Genes { @@ -14,6 +15,7 @@ namespace RJW_Genes { private const float REST_INCREASE = 0.05f; + private const float ORGASMS_NEEDED_FOR_SUPERCHARGE = 3.0f; public static void Postfix(SexProps props) { @@ -23,9 +25,37 @@ namespace RJW_Genes if (props.pawn.genes != null && props.pawn.genes.HasGene(GeneDefOf.rjw_genes_orgasm_rush)) { - props.pawn.needs.rest.CurLevel += REST_INCREASE; - } + + // Pump up Wake-Ness + if (props.pawn.needs.rest != null) + props.pawn.needs.rest.CurLevel += REST_INCREASE; + + // Add or Update Hediff for Orgasm Rush + Hediff rush = GetOrgasmRushHediff(props.pawn); + float added_severity = props.orgasms / ORGASMS_NEEDED_FOR_SUPERCHARGE; + rush.Severity += added_severity; + // Severity should be capped to 1 by the XML logic + } + + } + + /// + /// Helps to get the Orgasm Rush Hediff of a Pawn. If it does not exist, one is added. + /// + /// The pawn that had the orgasm, for which a hediff is looked up or created. + /// + public static Hediff GetOrgasmRushHediff(Pawn orgasmed) + { + Hediff orgasmRushHediff = orgasmed.health.hediffSet.GetFirstHediffOfDef(GeneDefOf.rjw_genes_orgasm_rush_hediff); + if (orgasmRushHediff == null) + { + orgasmRushHediff = HediffMaker.MakeHediff(GeneDefOf.rjw_genes_orgasm_rush_hediff, orgasmed); + orgasmRushHediff.Severity = 0; + orgasmed.health.AddHediff(orgasmRushHediff); + } + return orgasmRushHediff; } } + } diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index c7b5a48..48ab4dc 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -27,16 +27,14 @@ False - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll - False + ..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\licentia-labs-master\Assemblies\LicentiaLabs.dll False - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\rjw-master\1.4\Assemblies\RJW.dll - False + ..\..\rjw\1.4\Assemblies\RJW.dll @@ -51,12 +49,14 @@ - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll False - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll - False + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll + + + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll From 75891ca0b3813805b2739c730e54db6c92aa1f85 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Fri, 6 Jan 2023 11:43:18 +0100 Subject: [PATCH 04/13] Minor cleanups in Animal Inheritance, Bestiality Babies are now Hybrids --- Source/Animal_Inheritance/First.cs | 38 ------------------- .../Animal_Inheritance/InheritanceUtility.cs | 18 +++++++++ .../PatchRJWBestialityPregnancyUtility.cs | 13 ++++--- 3 files changed, 25 insertions(+), 44 deletions(-) delete mode 100644 Source/Animal_Inheritance/First.cs diff --git a/Source/Animal_Inheritance/First.cs b/Source/Animal_Inheritance/First.cs deleted file mode 100644 index 8194ab3..0000000 --- a/Source/Animal_Inheritance/First.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using rjw; -using Verse; -using RimWorld; - -namespace RJW_BGS -{ - [StaticConstructorOnStartup] - internal static class First - { - static First() - { - //RJWcopy.Racegroupdictbuilder(); - //Prints all found race dicts (debugging only) - //logAllFoundRaceGroupGenes - - } - - private static void logAllFoundRaceGroupGenes() - { - foreach (RaceGroupDef def in DefDatabase.AllDefs) - { - Log.Message("defName = " + def.defName); - if (def.raceNames != null) - { - foreach (string race in def.raceNames) - { - Log.Message(race); - } - } - } - } - } -} diff --git a/Source/Animal_Inheritance/InheritanceUtility.cs b/Source/Animal_Inheritance/InheritanceUtility.cs index 1996589..1af9e8a 100644 --- a/Source/Animal_Inheritance/InheritanceUtility.cs +++ b/Source/Animal_Inheritance/InheritanceUtility.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Verse; using RimWorld; +using rjw; namespace RJW_BGS { @@ -115,5 +116,22 @@ namespace RJW_BGS } } + /// + /// Used only for debugging, to see what you loaded and how it looks. + /// + private static void logAllFoundRaceGroupGenes() + { + foreach (RaceGroupDef def in DefDatabase.AllDefs) + { + Log.Message("defName = " + def.defName); + if (def.raceNames != null) + { + foreach (string race in def.raceNames) + { + Log.Message(race); + } + } + } + } } } diff --git a/Source/Animal_Inheritance/PatchRJWBestialityPregnancyUtility.cs b/Source/Animal_Inheritance/PatchRJWBestialityPregnancyUtility.cs index 5224c4f..b6b228b 100644 --- a/Source/Animal_Inheritance/PatchRJWBestialityPregnancyUtility.cs +++ b/Source/Animal_Inheritance/PatchRJWBestialityPregnancyUtility.cs @@ -25,20 +25,21 @@ namespace RJW_BGS baby.genes = new Pawn_GeneTracker(baby); } + //Remove the hair and skin genes pawns always start with, should get correct ones from human parent anyway. for (int i = baby.genes.Endogenes.Count - 1; i >= 0; i--) { baby.genes.RemoveGene(baby.genes.Endogenes[i]); } - List genes = PregnancyUtility.GetInheritedGenes(dad, mother); + List humangenes = PregnancyUtility.GetInheritedGenes(dad, mother); List beastgenes = InheritanceUtility.AnimalInheritedGenes(dad, mother); InheritanceUtility.AddGenes(baby, beastgenes); - InheritanceUtility.AddGenes(baby, genes); - //foreach (GeneDef gene in genes) - //{ - // baby.genes.AddGene(gene, false); - //} + InheritanceUtility.AddGenes(baby, humangenes); + + // The mix-breed babies should be labelled hybrids + baby.genes.hybrid = true; + baby.genes.xenotypeName = "Hybrid"; } } } From 8e63e69385f7f2893f0bb3fa1036645c5bcc37a2 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Fri, 6 Jan 2023 16:23:13 +0100 Subject: [PATCH 05/13] Added an Unbreakable Gene --- Common/Defs/Genes/GeneDefs_Damage.xml | 14 +++++ Common/Patches/Genes/Patch_Unbreakable.xml | 68 ++++++++++++++++++++++ Source/GeneDefOf.cs | 1 + Source/Genes/Damage/Gene_Elasticity.cs | 9 +-- Source/Genes/Damage/Gene_Unbreakable.cs | 41 +++++++++++++ Source/Genes/GeneUtility.cs | 10 ++++ 6 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 Common/Patches/Genes/Patch_Unbreakable.xml create mode 100644 Source/Genes/Damage/Gene_Unbreakable.cs diff --git a/Common/Defs/Genes/GeneDefs_Damage.xml b/Common/Defs/Genes/GeneDefs_Damage.xml index b3c21ef..8c8f87d 100644 --- a/Common/Defs/Genes/GeneDefs_Damage.xml +++ b/Common/Defs/Genes/GeneDefs_Damage.xml @@ -11,4 +11,18 @@ 1 + + rjw_genes_unbreakable + + rjw_genes_damage + This Gene makes the Carrier unable to get mood or social penalties from being raped and they cannot be broken for a long period of time. + UI/Icons/Rituals/TrialDefend + 2 + + RJW_Genes.Gene_Unbreakable + +
  • FeelingBroken
  • +
    +
    + \ No newline at end of file diff --git a/Common/Patches/Genes/Patch_Unbreakable.xml b/Common/Patches/Genes/Patch_Unbreakable.xml new file mode 100644 index 0000000..a2d674a --- /dev/null +++ b/Common/Patches/Genes/Patch_Unbreakable.xml @@ -0,0 +1,68 @@ + + + + + Defs/ThoughtDef[defName="FeelingBroken"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + + Defs/ThoughtDef[defName="GotRaped"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="GotAnalRaped"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="GotAnalRapedByFemale"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="GotRapedUnconscious"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="HateMyRapist"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="AllowedMeToGetRaped"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + +
    \ No newline at end of file diff --git a/Source/GeneDefOf.cs b/Source/GeneDefOf.cs index 631602f..4a499ea 100644 --- a/Source/GeneDefOf.cs +++ b/Source/GeneDefOf.cs @@ -67,6 +67,7 @@ namespace RJW_Genes // Damage & Side Effects [MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_elasticity; + public static readonly GeneDef rjw_genes_unbreakable; // Special public static readonly GeneDef rjw_genes_orgasm_rush; diff --git a/Source/Genes/Damage/Gene_Elasticity.cs b/Source/Genes/Damage/Gene_Elasticity.cs index 603a18d..5d92b51 100644 --- a/Source/Genes/Damage/Gene_Elasticity.cs +++ b/Source/Genes/Damage/Gene_Elasticity.cs @@ -10,8 +10,6 @@ namespace RJW_Genes /// public class Gene_Elasticity : Gene { - - private int ticksToReset = RESET_INTERVAL; private const int RESET_INTERVAL = 60000; // 60k should be 1 day public override void PostAdd() @@ -26,11 +24,8 @@ namespace RJW_Genes public override void Tick() { base.Tick(); - --this.ticksToReset; - if (this.ticksToReset > 0) - return; - this.ticksToReset = RESET_INTERVAL; - ResetSeverity(); + if (pawn.IsHashIntervalTick(RESET_INTERVAL)) + ResetSeverity(); } public override void PostRemove() diff --git a/Source/Genes/Damage/Gene_Unbreakable.cs b/Source/Genes/Damage/Gene_Unbreakable.cs new file mode 100644 index 0000000..2ebdad3 --- /dev/null +++ b/Source/Genes/Damage/Gene_Unbreakable.cs @@ -0,0 +1,41 @@ +using LicentiaLabs; +using rjw; +using Verse; + +namespace RJW_Genes +{ + /// + /// This Gene regularly removes the broken hediff of a pawn. + /// Blocking / Removing thoughts are done in an XML Patch. + /// + public class Gene_Unbreakable : Gene + { + /// DevNote: I first tried to Harmony-Postfix the AfterSexUtility and never add it - but that failed? + + private const int RESET_INTERVAL = 30000; // 30k should be 0.5 day + public override void PostAdd() + { + base.PostAdd(); + RemoveBrokenHediff(); + } + + public override void Tick() + { + base.Tick(); + if (pawn.IsHashIntervalTick(RESET_INTERVAL)) + RemoveBrokenHediff(); + } + + + + private void RemoveBrokenHediff() + { + // Clean-Up of existing feeling brokens + var maybeBrokenHediff = pawn.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken); + if (maybeBrokenHediff != null) + { + pawn.health.RemoveHediff(maybeBrokenHediff); + } + } + } +} diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index ce022ba..c4150ad 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -67,5 +67,15 @@ namespace RJW_Genes } return pawn.genes.HasGene(GeneDefOf.rjw_genes_generous_donor); } + + public static bool IsUnbreakable(Pawn pawn) + { + if (pawn.genes == null) + { + return false; + } + return pawn.genes.HasGene(GeneDefOf.rjw_genes_unbreakable); + } + } } \ No newline at end of file From 5ae3d0b13f94e589d3bac21cdee47fbe17ff82a2 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Fri, 6 Jan 2023 17:08:22 +0100 Subject: [PATCH 06/13] Added two Genes for changing biological age by sex --- Common/Defs/Genes/GeneDefs_SexSpecial.xml | 20 +++++++++++ Source/GeneDefOf.cs | 2 ++ Source/Genes/GeneUtility.cs | 18 ++++++++++ Source/Genes/Special/Patch_AgeDrain.cs | 38 ++++++++++++++++++++ Source/Genes/Special/Patch_Youth_Fountain.cs | 36 +++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 Source/Genes/Special/Patch_AgeDrain.cs create mode 100644 Source/Genes/Special/Patch_Youth_Fountain.cs diff --git a/Common/Defs/Genes/GeneDefs_SexSpecial.xml b/Common/Defs/Genes/GeneDefs_SexSpecial.xml index 51d4269..cae55e2 100644 --- a/Common/Defs/Genes/GeneDefs_SexSpecial.xml +++ b/Common/Defs/Genes/GeneDefs_SexSpecial.xml @@ -10,4 +10,24 @@ 1
    + + rjw_genes_youth_fountain + + rjw_genes_special + Having sex with a carrier of this gene makes the partner slightly younger. (Partner stays adult) + 1 + UI/Ideoligions/FireLeaves + 2 + + + + rjw_genes_sex_age_drain + + rjw_genes_special + Having sex transfers some of the partners life-time to themselves. (Pawn stays adult) + 1 + UI/Icons/ColonistBar/Idle + 3 + + \ No newline at end of file diff --git a/Source/GeneDefOf.cs b/Source/GeneDefOf.cs index 4a499ea..d2130af 100644 --- a/Source/GeneDefOf.cs +++ b/Source/GeneDefOf.cs @@ -71,6 +71,8 @@ namespace RJW_Genes // Special public static readonly GeneDef rjw_genes_orgasm_rush; + public static readonly GeneDef rjw_genes_youth_fountain; + public static readonly GeneDef rjw_genes_sex_age_drain; public static readonly HediffDef rjw_genes_orgasm_rush_hediff; diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index c4150ad..07a5c24 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -23,6 +23,24 @@ namespace RJW_Genes return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator); } + public static bool IsYouthFountain(Pawn pawn) + { + if (pawn.genes == null) + { + return false; + } + return pawn.genes.HasGene(GeneDefOf.rjw_genes_youth_fountain); + } + + internal static bool IsAgeDrainer(Pawn pawn) + { + if (pawn.genes == null) + { + return false; + } + return pawn.genes.HasGene(GeneDefOf.rjw_genes_sex_age_drain); + } + public static bool IsInsectBreeder(Pawn pawn) { if (pawn.genes == null) diff --git a/Source/Genes/Special/Patch_AgeDrain.cs b/Source/Genes/Special/Patch_AgeDrain.cs new file mode 100644 index 0000000..981f483 --- /dev/null +++ b/Source/Genes/Special/Patch_AgeDrain.cs @@ -0,0 +1,38 @@ +using HarmonyLib; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RJW_Genes.Genes.Special +{ + [HarmonyPatch(typeof(SexUtility), "Aftersex")] + public static class Patch_AgeDrain + { + + const long AGE_TRANSFERED = 120000; // 120k == 2 days + + // Comment Below in for debugging, changes years + // const long AGE_TRANSFERED = 6000000; // 6000k == 100 days + public static void Postfix(SexProps props) + { + if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal() ) + { + return; + } + if (GeneUtility.IsAgeDrainer(props.pawn)) + { + var pawnAge = props.pawn.ageTracker.AgeBiologicalTicks; + var pawnMinAge = props.pawn.ageTracker.AdultMinAgeTicks; + + // Make Partner older + props.partner.ageTracker.AgeBiologicalTicks += AGE_TRANSFERED; + // Make Pawn younger + props.pawn.ageTracker.AgeBiologicalTicks = Math.Max(pawnMinAge, pawnAge - AGE_TRANSFERED); + } + + } + } +} diff --git a/Source/Genes/Special/Patch_Youth_Fountain.cs b/Source/Genes/Special/Patch_Youth_Fountain.cs new file mode 100644 index 0000000..f2c7e13 --- /dev/null +++ b/Source/Genes/Special/Patch_Youth_Fountain.cs @@ -0,0 +1,36 @@ +using HarmonyLib; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RJW_Genes.Genes.Special +{ + [HarmonyPatch(typeof(SexUtility), "Aftersex")] + public static class Patch_Youth_Fountain + { + + const long AGE_REDUCTION = 60000; // 60k == 1 day + + // Comment Below in for debugging + //const long AGE_REDUCTION = 6000000; // 6000k == 100 days + public static void Postfix(SexProps props) + { + if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal()) + { + return; + } + if (GeneUtility.IsYouthFountain(props.pawn)) + { + var partnerAge = props.partner.ageTracker.AgeBiologicalTicks; + var minAge = props.partner.ageTracker.AdultMinAgeTicks; + + props.partner.ageTracker.AgeBiologicalTicks = Math.Max(minAge, partnerAge - AGE_REDUCTION); + } + + } + + } +} From a3fdf3bc48bd2a6271bac144667e8bd8319b52cd Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Fri, 6 Jan 2023 17:08:43 +0100 Subject: [PATCH 07/13] Minor Cleanup for Egg Fertilization --- Source/Genes/Breeding/Patch_EggFertilization.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/Genes/Breeding/Patch_EggFertilization.cs b/Source/Genes/Breeding/Patch_EggFertilization.cs index 46ec598..d2f2dcf 100644 --- a/Source/Genes/Breeding/Patch_EggFertilization.cs +++ b/Source/Genes/Breeding/Patch_EggFertilization.cs @@ -14,9 +14,8 @@ namespace RJW_Genes /// Normal Egg-Pregnancy logic is in https://gitgud.io/Ed86/rjw/-/blob/master/1.4/Source/Modules/Pregnancy/Pregnancy_Helper.cs /// [HarmonyPatch(typeof(SexUtility), "Aftersex")] - static class PatchEggFertilizationHelper + static class Patch_EggFertilization { - [HarmonyTranspiler] public static void Postfix(SexProps props) { // Only Fertilize on vaginal / anal sex @@ -59,7 +58,7 @@ namespace RJW_Genes } - private static Boolean canDoEggFertilization(Pawn a, Pawn b) + private static bool canDoEggFertilization(Pawn a, Pawn b) { // No Partner / Other Errors From 6ea89c189cbcf5f51644b679b7b40da147337651 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Fri, 6 Jan 2023 17:14:51 +0100 Subject: [PATCH 08/13] Updated complexities and metabolism, changelog update for today --- CHANGELOG.md | 17 +++++++++++++++++ Common/Defs/Genes/GeneDefs_Breeding.xml | 10 ++++++++-- Common/Defs/Genes/GeneDefs_Damage.xml | 4 ++++ Common/Defs/Genes/GeneDefs_Reproduction.xml | 1 + Common/Defs/Genes/GeneDefs_SexSpecial.xml | 7 +++++-- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fce2807..22ede1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# 1.1.0 (2023-xx-xx) + +Features: + +- Succubus (see below) +- Orgasm Rush got a Hediff +- Unbreakable Gene +- Age-Transfer and Youth-Fountain per Sex Gene +- Balancing some Genes by changing metabolism and complexity + +Succubus: + +Fixes: + +- Issue with Breast-Size (#8) fixed by lowercasing breast-match (Shabakur) +- Error on Game Load when Licentia Genes are tried to be added to Xenotypes for players without Licentia (#5) + # 1.0.1 (2022-12-20) - Fix issue with Orgasm Rush throwing an Error on Animal Orgasm (Thanks Shabakur) diff --git a/Common/Defs/Genes/GeneDefs_Breeding.xml b/Common/Defs/Genes/GeneDefs_Breeding.xml index fa65c52..bd201cc 100644 --- a/Common/Defs/Genes/GeneDefs_Breeding.xml +++ b/Common/Defs/Genes/GeneDefs_Breeding.xml @@ -8,7 +8,9 @@ Pawns with this gene are able to birth mechanoids unharmed. World/WorldObjects/Expanding/Mechanoids 51 - rjw_genes_breeding + rjw_genes_breeding + 1 + -1
    @@ -17,7 +19,9 @@ Pawns with this gene are able to hold more insect eggs. Genes/Icons/More_Egg_Space 52 - rjw_genes_breeding + rjw_genes_breeding + 1 + -1 @@ -27,6 +31,8 @@ World/WorldObjects/Expanding/Insects 53 rjw_genes_breeding + 1 + -1 diff --git a/Common/Defs/Genes/GeneDefs_Damage.xml b/Common/Defs/Genes/GeneDefs_Damage.xml index 8c8f87d..f2b0e07 100644 --- a/Common/Defs/Genes/GeneDefs_Damage.xml +++ b/Common/Defs/Genes/GeneDefs_Damage.xml @@ -8,6 +8,8 @@ This Xenotype cannot get stretched by huge penetrators. Genes/Icons/Elasticity RJW_Genes.Gene_Elasticity + -1 + 1 1 @@ -18,6 +20,8 @@ This Gene makes the Carrier unable to get mood or social penalties from being raped and they cannot be broken for a long period of time. UI/Icons/Rituals/TrialDefend 2 + -1 + 1 RJW_Genes.Gene_Unbreakable diff --git a/Common/Defs/Genes/GeneDefs_Reproduction.xml b/Common/Defs/Genes/GeneDefs_Reproduction.xml index ef348fd..614bb38 100644 --- a/Common/Defs/Genes/GeneDefs_Reproduction.xml +++ b/Common/Defs/Genes/GeneDefs_Reproduction.xml @@ -21,6 +21,7 @@ Reproduction Xenotypes with this Gene are Rapists. Genes/Icons/Rape + 1 2
  • diff --git a/Common/Defs/Genes/GeneDefs_SexSpecial.xml b/Common/Defs/Genes/GeneDefs_SexSpecial.xml index cae55e2..3257882 100644 --- a/Common/Defs/Genes/GeneDefs_SexSpecial.xml +++ b/Common/Defs/Genes/GeneDefs_SexSpecial.xml @@ -6,6 +6,7 @@ rjw_genes_special On Orgasm, carriers of this gene get a boost in activity. (rest-need is partially filled) 1 + -2 UI/Memes/FleshPurity 1 @@ -15,7 +16,8 @@ rjw_genes_special Having sex with a carrier of this gene makes the partner slightly younger. (Partner stays adult) - 1 + 2 + -2 UI/Ideoligions/FireLeaves 2 @@ -25,7 +27,8 @@ rjw_genes_special Having sex transfers some of the partners life-time to themselves. (Pawn stays adult) - 1 + 2 + -1 UI/Icons/ColonistBar/Idle 3 From ee85bd750de5eb5f5b0914af8d553b2d3cce66eb Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sat, 7 Jan 2023 16:51:34 +0100 Subject: [PATCH 09/13] Fixed Age-Drain Meme to lock to 20y and not ... 14, which is rimworld adult age --- Source/Common/ModLog.cs | 34 ++++++++++++++++++++ Source/Genes/GeneUtility.cs | 2 +- Source/Genes/Special/Patch_AgeDrain.cs | 8 +++-- Source/Genes/Special/Patch_Youth_Fountain.cs | 14 ++++++-- 4 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 Source/Common/ModLog.cs diff --git a/Source/Common/ModLog.cs b/Source/Common/ModLog.cs new file mode 100644 index 0000000..407520a --- /dev/null +++ b/Source/Common/ModLog.cs @@ -0,0 +1,34 @@ +using Verse; + +namespace RJW_Genes +{ + internal class ModLog + { + public static string ModId => "RJW-Genes"; + + /// + /// Logs the given message with [SaveStorage.ModId] appended. + /// + public static void Error(string message) + { + Log.Error($"[{ModId}] {message}"); + } + + /// + /// Logs the given message with [SaveStorage.ModId] appended. + /// + public static void Message(string message) + { + Log.Message($"[{ModId}] {message}"); + } + + /// + /// Logs the given message with [SaveStorage.ModId] appended. + /// + public static void Warning(string message) + { + Log.Warning($"[{ModId}] {message}"); + } + + } +} diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index 07a5c24..e2ac018 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -32,7 +32,7 @@ namespace RJW_Genes return pawn.genes.HasGene(GeneDefOf.rjw_genes_youth_fountain); } - internal static bool IsAgeDrainer(Pawn pawn) + public static bool IsAgeDrainer(Pawn pawn) { if (pawn.genes == null) { diff --git a/Source/Genes/Special/Patch_AgeDrain.cs b/Source/Genes/Special/Patch_AgeDrain.cs index 981f483..2c7e55d 100644 --- a/Source/Genes/Special/Patch_AgeDrain.cs +++ b/Source/Genes/Special/Patch_AgeDrain.cs @@ -13,9 +13,11 @@ namespace RJW_Genes.Genes.Special { const long AGE_TRANSFERED = 120000; // 120k == 2 days + // 20 Years * 60 Days / Year * 60k Ticks/Day + 1 for safety + const long MINIMUM_AGE = 20 * 60 * 60000 + 1; // Comment Below in for debugging, changes years - // const long AGE_TRANSFERED = 6000000; // 6000k == 100 days + // const long AGE_TRANSFERED = 12000000; public static void Postfix(SexProps props) { if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal() ) @@ -25,12 +27,12 @@ namespace RJW_Genes.Genes.Special if (GeneUtility.IsAgeDrainer(props.pawn)) { var pawnAge = props.pawn.ageTracker.AgeBiologicalTicks; - var pawnMinAge = props.pawn.ageTracker.AdultMinAgeTicks; + //ModLog.Error($"Firing Age Drain \nMinimum Age is \t{MINIMUM_AGE} \nPawn Age is \t{pawnAge} \nTransferred \t{AGE_TRANSFERED}\nResulting in \t{pawnAge - AGE_TRANSFERED}"); // Make Partner older props.partner.ageTracker.AgeBiologicalTicks += AGE_TRANSFERED; // Make Pawn younger - props.pawn.ageTracker.AgeBiologicalTicks = Math.Max(pawnMinAge, pawnAge - AGE_TRANSFERED); + props.pawn.ageTracker.AgeBiologicalTicks = Math.Max(MINIMUM_AGE, (pawnAge - AGE_TRANSFERED)); } } diff --git a/Source/Genes/Special/Patch_Youth_Fountain.cs b/Source/Genes/Special/Patch_Youth_Fountain.cs index f2c7e13..a1a1840 100644 --- a/Source/Genes/Special/Patch_Youth_Fountain.cs +++ b/Source/Genes/Special/Patch_Youth_Fountain.cs @@ -13,9 +13,11 @@ namespace RJW_Genes.Genes.Special { const long AGE_REDUCTION = 60000; // 60k == 1 day + // 20 Years * 60 Days / Year * 60k Ticks/Day + 1 for safety + const long MINIMUM_AGE = 20 * 60 * 60000 + 1; // Comment Below in for debugging - //const long AGE_REDUCTION = 6000000; // 6000k == 100 days + // const long AGE_REDUCTION = 6000000; // 6000k == 100 days public static void Postfix(SexProps props) { if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal()) @@ -25,12 +27,18 @@ namespace RJW_Genes.Genes.Special if (GeneUtility.IsYouthFountain(props.pawn)) { var partnerAge = props.partner.ageTracker.AgeBiologicalTicks; - var minAge = props.partner.ageTracker.AdultMinAgeTicks; - props.partner.ageTracker.AgeBiologicalTicks = Math.Max(minAge, partnerAge - AGE_REDUCTION); + //ModLog.Error($"Firing Youth Fountain \nMinimum Age is \t{MINIMUM_AGE}\t{ticksToYears(MINIMUM_AGE)}y\nPawn Age is \t{partnerAge}\t{ticksToYears(partnerAge)}y \nTransferred \t {AGE_REDUCTION}\t{ticksToYears(AGE_REDUCTION)}y\nResulting in \t{partnerAge - AGE_REDUCTION}\t{ticksToYears(partnerAge - AGE_REDUCTION)}y"); + + props.partner.ageTracker.AgeBiologicalTicks = Math.Max(MINIMUM_AGE, partnerAge - AGE_REDUCTION); } } + private static float ticksToYears(long ticks) + { + return (ticks / 60000f) / 60f; + } } + } From be7f280ae75815e2d77ce6e5b304db9e43db0a4f Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sun, 15 Jan 2023 08:07:51 +0100 Subject: [PATCH 10/13] Added Sexuality Genes --- CHANGELOG.md | 1 + Common/Defs/Genes/GeneDefs_Reproduction.xml | 37 +++++++++++++++++++++ Source/GeneDefOf.cs | 4 ++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22ede1f..65f6229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Features: - Orgasm Rush got a Hediff - Unbreakable Gene - Age-Transfer and Youth-Fountain per Sex Gene +- Bisexual and Homosexual Genes with Placeholder Icon - Balancing some Genes by changing metabolism and complexity Succubus: diff --git a/Common/Defs/Genes/GeneDefs_Reproduction.xml b/Common/Defs/Genes/GeneDefs_Reproduction.xml index 614bb38..97fb937 100644 --- a/Common/Defs/Genes/GeneDefs_Reproduction.xml +++ b/Common/Defs/Genes/GeneDefs_Reproduction.xml @@ -29,4 +29,41 @@
  • + + + rjw_genes_homosexual + + Reproduction + This Gene makes you gay. + UI\Ideoligions\Universal\RoundC + 0 + 3 + +
  • + Gay +
  • +
    + +
  • rjw_genes_sexual_orientation
  • +
    +
    + + + rjw_genes_bisexual + + Reproduction + Carriers of this Gene are Bisexual. + UI\Ideoligions\Universal\RoundC + 0 + 4 + +
  • + Bisexual +
  • +
    + +
  • rjw_genes_sexual_orientation
  • +
    +
    + \ No newline at end of file diff --git a/Source/GeneDefOf.cs b/Source/GeneDefOf.cs index d2130af..6b13cfb 100644 --- a/Source/GeneDefOf.cs +++ b/Source/GeneDefOf.cs @@ -51,6 +51,7 @@ namespace RJW_Genes public static readonly GeneDef rjw_genes_mechbreeder; public static readonly GeneDef rjw_genes_insectincubator; public static readonly GeneDef rjw_genes_insectbreeder; + public static readonly GeneDef rjw_genes_zoophile; // Cum public static readonly GeneDef rjw_genes_no_cum; @@ -63,7 +64,8 @@ namespace RJW_Genes // Reproduction public static readonly GeneDef rjw_genes_hypersexual; public static readonly GeneDef rjw_genes_rapist; - public static readonly GeneDef rjw_genes_zoophile; + public static readonly GeneDef rjw_genes_homosexual; + public static readonly GeneDef rjw_genes_bisexual; // Damage & Side Effects [MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_elasticity; From fd88a138486be08ece3083874c7bcbd8880eed69 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sun, 15 Jan 2023 08:14:18 +0100 Subject: [PATCH 11/13] Fixed #2 by checking if pawn is already a futa before adding extra genitalia --- CHANGELOG.md | 1 + Source/Genes/ExtraGenitalia/Gene_Futa.cs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65f6229..3bce20b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Fixes: - Issue with Breast-Size (#8) fixed by lowercasing breast-match (Shabakur) - Error on Game Load when Licentia Genes are tried to be added to Xenotypes for players without Licentia (#5) +- Futa Gene only triggers if Pawn is not a futa already (#2) # 1.0.1 (2022-12-20) diff --git a/Source/Genes/ExtraGenitalia/Gene_Futa.cs b/Source/Genes/ExtraGenitalia/Gene_Futa.cs index 2d9f367..812f381 100644 --- a/Source/Genes/ExtraGenitalia/Gene_Futa.cs +++ b/Source/Genes/ExtraGenitalia/Gene_Futa.cs @@ -13,6 +13,12 @@ namespace RJW_Genes { base.PostMake(); + // If the Pawn is already a Futa, do not do anything. Can Happen by Base-RJW Spawn Chance or potentially races / other mods. + if (IsAlreadyFuta(pawn)) + { + return; + } + if (GenderUtility.IsFemale(pawn) && additional_genital == null) { createAndAddPenis(); @@ -27,6 +33,12 @@ namespace RJW_Genes { base.PostAdd(); + // If the Pawn is already a Futa, do not do anything. Can Happen by Base-RJW Spawn Chance or potentially races / other mods. + if (IsAlreadyFuta(pawn)) + { + return; + } + if (pawn.gender == Gender.Female && additional_genital == null) { createAndAddPenis(); @@ -79,5 +91,15 @@ namespace RJW_Genes pawn.health.AddHediff(additional_genital, partBPR); } + private static bool IsAlreadyFuta(Pawn pawn) + { + if (pawn == null) + return false; + if (!Genital_Helper.has_genitals(pawn)) + return false; + return + (Genital_Helper.has_penis_fertile(pawn) || Genital_Helper.has_penis_infertile(pawn)) + && Genital_Helper.has_vagina(pawn) ; + } } } From 4cd77eba50898fe98f4bca11030512b9d2a4163d Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sun, 15 Jan 2023 09:18:04 +0100 Subject: [PATCH 12/13] Resizing Genes now trigger on 20th Birthday Earliest, Fixes #11 --- CHANGELOG.md | 1 + Common/Defs/Genes/GeneCategories.xml | 2 +- Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml | 16 +++--- Source/Genes/GeneUtility.cs | 21 ++++++++ Source/Genes/GenitaliaSize/Gene_BigBreasts.cs | 18 ++----- .../GenitaliaSize/Gene_BigMaleGenitalia.cs | 16 ++---- .../Gene_GenitaliaResizingGene.cs | 49 +++++++++++++++++++ Source/Genes/GenitaliaSize/Gene_LooseAnus.cs | 20 ++------ .../Gene_LooseFemaleGenitalia.cs | 20 ++------ .../Genes/GenitaliaSize/Gene_SmallBreasts.cs | 17 ++----- .../GenitaliaSize/Gene_SmallMaleGenitalia.cs | 16 ++---- Source/Genes/GenitaliaSize/Gene_TightAnus.cs | 17 ++----- .../Gene_TightFemaleGenitalia.cs | 16 ++---- .../Patch_ResizingOnAdulthood.cs | 30 ++++++++++++ 14 files changed, 140 insertions(+), 119 deletions(-) create mode 100644 Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs create mode 100644 Source/Genes/GenitaliaSize/Patch_ResizingOnAdulthood.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bce20b..28a4e46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Fixes: - Issue with Breast-Size (#8) fixed by lowercasing breast-match (Shabakur) - Error on Game Load when Licentia Genes are tried to be added to Xenotypes for players without Licentia (#5) - Futa Gene only triggers if Pawn is not a futa already (#2) +- Genitalia Resizing triggers on 20th Birthday (#11) # 1.0.1 (2022-12-20) diff --git a/Common/Defs/Genes/GeneCategories.xml b/Common/Defs/Genes/GeneCategories.xml index ab92117..81208b9 100644 --- a/Common/Defs/Genes/GeneCategories.xml +++ b/Common/Defs/Genes/GeneCategories.xml @@ -57,7 +57,7 @@ rjw_genes_special - + 8 diff --git a/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml b/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml index 89bc7f9..cc26c04 100644 --- a/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml +++ b/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml @@ -9,7 +9,7 @@ rjw_genes_big_male_genitalia - Penises of this Xenotype are bigger. + Penises of this Xenotype are bigger.(Resizing takes place at 20th Birthday) Genes/Icons/Small_Male_Genitalia RJW_Genes.Gene_BigMaleGenitalia 751 @@ -21,7 +21,7 @@ rjw_genes_small_male_genitalia - Penises of this Xenotype are smaller. + Penises of this Xenotype are smaller. (Resizing takes place at 20th Birthday) Genes/Icons/Big_Male_Genitalia RJW_Genes.Gene_SmallMaleGenitalia 753 @@ -34,7 +34,7 @@ rjw_genes_loose_female_genitalia - Vaginas of this Xenotype are quite spacy. + Vaginas of this Xenotype are quite spacy. (Resizing takes place at 20th Birthday) Genes/Icons/Loose_Female_Genitalia RJW_Genes.Gene_LooseFemaleGenitalia 754 @@ -46,7 +46,7 @@ rjw_genes_tight_female_genitalia - Vaginas of this Xenotype are pretty tight. + Vaginas of this Xenotype are pretty tight.(Resizing takes place at 20th Birthday) Genes/Icons/Tight_Female_Genitalia RJW_Genes.Gene_TightFemaleGenitalia 756 @@ -59,7 +59,7 @@ rjw_genes_big_breasts - Females of this Xenotype have big honkers. + Females of this Xenotype have big honkers.(Resizing takes place at 20th Birthday) Genes/Icons/Big_Breasts RJW_Genes.Gene_BigBreasts 757 @@ -71,7 +71,7 @@ rjw_genes_small_breasts - Females of this Xenotype have smaller breasts. + Females of this Xenotype have smaller breasts.(Resizing takes place at 20th Birthday) Genes/Icons/Small_Breasts RJW_Genes.Gene_SmallBreasts 759 @@ -84,7 +84,7 @@ rjw_genes_loose_anus - The Anus of this Xenotype is roomy. + The Anus of this Xenotype is roomy.(Resizing takes place at 20th Birthday) Genes/Icons/Loose_Anus RJW_Genes.Gene_LooseAnus 760 @@ -96,7 +96,7 @@ rjw_genes_tight_anus - The anus of this Xenotype is small. + The anus of this Xenotype is small.(Resizing takes place at 20th Birthday) Genes/Icons/Tight_Anus RJW_Genes.Gene_TightAnus 762 diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index e2ac018..d9251d3 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Verse; namespace RJW_Genes @@ -95,5 +96,25 @@ namespace RJW_Genes return pawn.genes.HasGene(GeneDefOf.rjw_genes_unbreakable); } + + public static bool HasGenitaliaResizingGenes(Pawn pawn) + { + return !GetGenitaliaResizingGenes(pawn).NullOrEmpty(); + } + + public static List GetGenitaliaResizingGenes(Pawn pawn) + { + var ResizingGenes = new List(); + + // Error Handling: Issue with Pawn or Genes return empty. + if (pawn == null || pawn.genes == null) + return ResizingGenes; + + foreach (Gene g in pawn.genes.GenesListForReading) + if (g is Gene_GenitaliaResizingGene) + ResizingGenes.Add(g); + + return ResizingGenes; + } } } \ No newline at end of file diff --git a/Source/Genes/GenitaliaSize/Gene_BigBreasts.cs b/Source/Genes/GenitaliaSize/Gene_BigBreasts.cs index b0e61ad..b1c6e4f 100644 --- a/Source/Genes/GenitaliaSize/Gene_BigBreasts.cs +++ b/Source/Genes/GenitaliaSize/Gene_BigBreasts.cs @@ -1,24 +1,12 @@ using Verse; namespace RJW_Genes { - public class Gene_BigBreasts : RJW_Gene + public class Gene_BigBreasts : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - - if (pawn.gender == Gender.Female) - SizeAdjuster.AdjustAllBreastSizes(pawn,0.5f,1.0f); - } - - public override void PostAdd() - { - base.PostAdd(); if (pawn.gender == Gender.Female) SizeAdjuster.AdjustAllBreastSizes(pawn, 0.5f, 1.0f); } - - } -} +} \ No newline at end of file diff --git a/Source/Genes/GenitaliaSize/Gene_BigMaleGenitalia.cs b/Source/Genes/GenitaliaSize/Gene_BigMaleGenitalia.cs index b04df46..8cee1ef 100644 --- a/Source/Genes/GenitaliaSize/Gene_BigMaleGenitalia.cs +++ b/Source/Genes/GenitaliaSize/Gene_BigMaleGenitalia.cs @@ -1,20 +1,10 @@ namespace RJW_Genes { - public class Gene_BigMaleGenitalia : RJW_Gene + public class Gene_BigMaleGenitalia : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - - SizeAdjuster.AdjustAllPenisSizes(pawn,0.5f,1.0f); - } - - public override void PostAdd() - { - base.PostAdd(); SizeAdjuster.AdjustAllPenisSizes(pawn, 0.5f, 1.0f); } - } -} +} \ No newline at end of file diff --git a/Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs b/Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs new file mode 100644 index 0000000..ee24126 --- /dev/null +++ b/Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs @@ -0,0 +1,49 @@ +namespace RJW_Genes +{ + /// + /// Parent Gene for Genitalia Resizing. All Resizing genes should inherit for this class. + /// + /// This helps with some functions (e.g. "hasGenitaliaResizingGenes(pawn)") but also to fire genitalia resizing later in life for Pawns. + /// (No Children with huge ding dongs, and I don't want kids with tight anuses I am not that degenerate) + /// + public abstract class Gene_GenitaliaResizingGene : RJW_Gene + { + + public const int RESIZING_AGE = 20; + public bool WasApplied { get; set; } + + public override void PostMake() + { + base.PostMake(); + if (pawn.ageTracker.AgeBiologicalYears >= RESIZING_AGE) + { + Resize(); + WasApplied = true; + } + } + + public override void PostAdd() + { + base.PostAdd(); + if (pawn.ageTracker.AgeBiologicalYears >= RESIZING_AGE) + { + Resize(); + WasApplied = true; + } + } + + /// + /// Used to resize the pawns genitalia. + /// All Logic should be put here: + /// 1. Filters for Gender + /// 2. Filters for Genitalia Existance + /// 3. Selection of right Genitalia + /// 4. Adjustment of Size + /// + /// I kept it intentionally broad, so that e.g. the Penis Resize can resize multiple penises and also for futas, + /// while the breast-gene is female only. + /// + public abstract void Resize(); + + } +} \ No newline at end of file diff --git a/Source/Genes/GenitaliaSize/Gene_LooseAnus.cs b/Source/Genes/GenitaliaSize/Gene_LooseAnus.cs index f5a5312..520eb5a 100644 --- a/Source/Genes/GenitaliaSize/Gene_LooseAnus.cs +++ b/Source/Genes/GenitaliaSize/Gene_LooseAnus.cs @@ -1,22 +1,12 @@ -namespace RJW_Genes +using Verse; + +namespace RJW_Genes { - public class Gene_LooseAnus : RJW_Gene + public class Gene_LooseAnus : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - SizeAdjuster.AdjustAllAnusSizes(pawn, 0.5f, 1.0f); } - - public override void PostAdd() - { - base.PostAdd(); - SizeAdjuster.AdjustAllAnusSizes(pawn, 0.5f, 1.0f); - } - - - } } diff --git a/Source/Genes/GenitaliaSize/Gene_LooseFemaleGenitalia.cs b/Source/Genes/GenitaliaSize/Gene_LooseFemaleGenitalia.cs index 68578b6..2885c07 100644 --- a/Source/Genes/GenitaliaSize/Gene_LooseFemaleGenitalia.cs +++ b/Source/Genes/GenitaliaSize/Gene_LooseFemaleGenitalia.cs @@ -1,22 +1,12 @@ -namespace RJW_Genes +using Verse; + +namespace RJW_Genes { - public class Gene_LooseFemaleGenitalia : RJW_Gene + public class Gene_LooseFemaleGenitalia : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.5f, 1.0f); } - - public override void PostAdd() - { - base.PostAdd(); - SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.5f, 1.0f); - } - - - } } diff --git a/Source/Genes/GenitaliaSize/Gene_SmallBreasts.cs b/Source/Genes/GenitaliaSize/Gene_SmallBreasts.cs index d5b4a4e..2e8af43 100644 --- a/Source/Genes/GenitaliaSize/Gene_SmallBreasts.cs +++ b/Source/Genes/GenitaliaSize/Gene_SmallBreasts.cs @@ -1,18 +1,11 @@ -namespace RJW_Genes +using Verse; + +namespace RJW_Genes { - public class Gene_SmallBreasts : RJW_Gene + public class Gene_SmallBreasts : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - - SizeAdjuster.AdjustAllBreastSizes(pawn, 0.0f, 0.5f); - } - - public override void PostAdd() - { - base.PostAdd(); SizeAdjuster.AdjustAllBreastSizes(pawn, 0.0f, 0.5f); } } diff --git a/Source/Genes/GenitaliaSize/Gene_SmallMaleGenitalia.cs b/Source/Genes/GenitaliaSize/Gene_SmallMaleGenitalia.cs index 12ba154..ce5d33a 100644 --- a/Source/Genes/GenitaliaSize/Gene_SmallMaleGenitalia.cs +++ b/Source/Genes/GenitaliaSize/Gene_SmallMaleGenitalia.cs @@ -1,20 +1,10 @@ namespace RJW_Genes { - public class Gene_SmallMaleGenitalia : RJW_Gene + public class Gene_SmallMaleGenitalia : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - - SizeAdjuster.AdjustAllPenisSizes(pawn,0.0f,0.5f); - } - - public override void PostAdd() - { - base.PostAdd(); SizeAdjuster.AdjustAllPenisSizes(pawn, 0.0f, 0.5f); } - } -} +} \ No newline at end of file diff --git a/Source/Genes/GenitaliaSize/Gene_TightAnus.cs b/Source/Genes/GenitaliaSize/Gene_TightAnus.cs index 56f52cd..443aba7 100644 --- a/Source/Genes/GenitaliaSize/Gene_TightAnus.cs +++ b/Source/Genes/GenitaliaSize/Gene_TightAnus.cs @@ -1,21 +1,10 @@ namespace RJW_Genes { - public class Gene_TightAnus : RJW_Gene + public class Gene_TightAnus : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - SizeAdjuster.AdjustAllAnusSizes(pawn, 0.0f, 0.5f); } - - public override void PostAdd() - { - base.PostAdd(); - SizeAdjuster.AdjustAllAnusSizes(pawn, 0.0f, 0.5f); - } - - } -} +} \ No newline at end of file diff --git a/Source/Genes/GenitaliaSize/Gene_TightFemaleGenitalia.cs b/Source/Genes/GenitaliaSize/Gene_TightFemaleGenitalia.cs index 53ec2a7..306635d 100644 --- a/Source/Genes/GenitaliaSize/Gene_TightFemaleGenitalia.cs +++ b/Source/Genes/GenitaliaSize/Gene_TightFemaleGenitalia.cs @@ -1,20 +1,10 @@ namespace RJW_Genes { - public class Gene_TightFemaleGenitalia : RJW_Gene + public class Gene_TightFemaleGenitalia : Gene_GenitaliaResizingGene { - - public override void PostMake() + public override void Resize() { - base.PostMake(); - SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.0f, 0.5f); } - - public override void PostAdd() - { - base.PostAdd(); - SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.0f, 0.5f); - } - } -} +} \ No newline at end of file diff --git a/Source/Genes/GenitaliaSize/Patch_ResizingOnAdulthood.cs b/Source/Genes/GenitaliaSize/Patch_ResizingOnAdulthood.cs new file mode 100644 index 0000000..b8542a0 --- /dev/null +++ b/Source/Genes/GenitaliaSize/Patch_ResizingOnAdulthood.cs @@ -0,0 +1,30 @@ +using HarmonyLib; +using Verse; + +namespace RJW_Genes +{ + /// + /// This Patch adds behavior to all resizing genes: + /// At Age RESIZING_MIN_AGE the Pawns Resizing Genes will trigger again, if not already triggered somewhere else. + /// This is meant to allow kids to grow up without resized genitals, and resize later (Fixing #11). + /// + [HarmonyPatch(typeof(Pawn_AgeTracker), "BirthdayBiological")] + public class Patch_ResizingOnAdulthood + { + + static void Postfix(Pawn ___pawn, int birthdayAge) + { + if (birthdayAge >= Gene_GenitaliaResizingGene.RESIZING_AGE) + { + foreach(Gene_GenitaliaResizingGene gene in GeneUtility.GetGenitaliaResizingGenes(___pawn)) + { + if (!gene.WasApplied) + { + gene.Resize(); + gene.WasApplied = true; + } + } + } + } + } +} \ No newline at end of file From ba7b72b42668e2c0f467df6d85bd1f5dfb85427d Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sun, 15 Jan 2023 09:50:29 +0100 Subject: [PATCH 13/13] Minor Cleanups --- Source/Animal_Inheritance/RaceGeneDef_Helper.cs | 11 ++++++----- Source/Genes/GeneUtility.cs | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Source/Animal_Inheritance/RaceGeneDef_Helper.cs b/Source/Animal_Inheritance/RaceGeneDef_Helper.cs index 680b155..3db664c 100644 --- a/Source/Animal_Inheritance/RaceGeneDef_Helper.cs +++ b/Source/Animal_Inheritance/RaceGeneDef_Helper.cs @@ -1,11 +1,8 @@ -using System; +using rjw; +using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using rjw; using Verse; -using RimWorld; namespace RJW_BGS { @@ -44,6 +41,7 @@ namespace RJW_BGS }).ToList(); if (pawnKindDefs.Count() > 0) return pawnKindDefs; + List raceKindDefs = allDefs.Where(delegate (RaceGeneDef group) { List raceNames = group.raceNames; @@ -51,6 +49,7 @@ namespace RJW_BGS }).ToList(); if (raceKindDefs.Count() > 0) return raceKindDefs; + List raceGroupDefs = new List(); if (raceGroupDef != null) { @@ -60,8 +59,10 @@ namespace RJW_BGS return raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName; }).ToList(); } + if (raceGroupDefs.Count() > 0) return raceGroupDefs; + return new List(); } } diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index d9251d3..284aab2 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -102,17 +102,17 @@ namespace RJW_Genes return !GetGenitaliaResizingGenes(pawn).NullOrEmpty(); } - public static List GetGenitaliaResizingGenes(Pawn pawn) + public static List GetGenitaliaResizingGenes(Pawn pawn) { - var ResizingGenes = new List(); + var ResizingGenes = new List(); // Error Handling: Issue with Pawn or Genes return empty. if (pawn == null || pawn.genes == null) return ResizingGenes; - foreach (Gene g in pawn.genes.GenesListForReading) - if (g is Gene_GenitaliaResizingGene) - ResizingGenes.Add(g); + foreach (Gene gene in pawn.genes.GenesListForReading) + if (gene is Gene_GenitaliaResizingGene resizing_gene) + ResizingGenes.Add(resizing_gene); return ResizingGenes; }