diff --git a/Common/Assemblies/Rjw-Genes.dll b/Common/Assemblies/Rjw-Genes.dll index 7502255..cb0815e 100644 Binary files a/Common/Assemblies/Rjw-Genes.dll and b/Common/Assemblies/Rjw-Genes.dll differ diff --git a/Common/Defs/Genes/GeneCategories.xml b/Common/Defs/Genes/GeneCategories.xml index 10aa8e9..68dc199 100644 --- a/Common/Defs/Genes/GeneCategories.xml +++ b/Common/Defs/Genes/GeneCategories.xml @@ -4,30 +4,55 @@ rjw_genes_gender - 20 + 21 - rjw_genes_genitalia - - 16 + rjw_genes_genitalia_type + + 19 + + + + rjw_genes_genitalia_extras + + 17 + + + + rjw_genes_genitalia_size + + 15 rjw_genes_breeding - 15 + 13 rjw_genes_cum - 14 + 12 + + + + rjw_damage + + 11 \ No newline at end of file diff --git a/Common/Defs/Genes/GeneDefs_Breeding.xml b/Common/Defs/Genes/GeneDefs_Breeding.xml index 14b1be7..793492f 100644 --- a/Common/Defs/Genes/GeneDefs_Breeding.xml +++ b/Common/Defs/Genes/GeneDefs_Breeding.xml @@ -26,7 +26,21 @@ Pawns with this gene are able to fertilize eggs with any fertile penis. World/WorldObjects/Expanding/Mechanoids 53 - rjw_genes_breeding + rjw_genes_breeding + + rjw_genes_zoophile + + rjw_genes_breeding + Xenotypes with this Gene are Zoophile. + Genes/Icons/Placeholder + 54 + +
  • + Zoophile +
  • +
    +
    + \ No newline at end of file diff --git a/Common/Defs/Genes/GeneDefs_Damage.xml b/Common/Defs/Genes/GeneDefs_Damage.xml new file mode 100644 index 0000000..c44e937 --- /dev/null +++ b/Common/Defs/Genes/GeneDefs_Damage.xml @@ -0,0 +1,14 @@ + + + + + rjw_genes_elasticity + + rjw_damage + This Xenotype cannot get stretched by huge penetrators. + Genes/Icons/Placeholder + RJW_Genes.Gene_Elasticity + 1 + + + \ No newline at end of file diff --git a/Common/Defs/Genes/GeneDefs_ExtraGenitaliaEndogenes.xml b/Common/Defs/Genes/GeneDefs_ExtraGenitalia.xml similarity index 98% rename from Common/Defs/Genes/GeneDefs_ExtraGenitaliaEndogenes.xml rename to Common/Defs/Genes/GeneDefs_ExtraGenitalia.xml index 703d8db..3459de5 100644 --- a/Common/Defs/Genes/GeneDefs_ExtraGenitaliaEndogenes.xml +++ b/Common/Defs/Genes/GeneDefs_ExtraGenitalia.xml @@ -1,7 +1,7 @@ - rjw_genes_genitalia + rjw_genes_genitalia_extras diff --git a/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml b/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml index 41dac59..72d2c53 100644 --- a/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml +++ b/Common/Defs/Genes/GeneDefs_GenitaliaSizes.xml @@ -1,7 +1,7 @@ - rjw_genes_genitalia + rjw_genes_genitalia_size diff --git a/Common/Defs/Genes/GeneDefs_GenitaliaTypeEndogenes.xml b/Common/Defs/Genes/GeneDefs_GenitaliaTypes.xml similarity index 97% rename from Common/Defs/Genes/GeneDefs_GenitaliaTypeEndogenes.xml rename to Common/Defs/Genes/GeneDefs_GenitaliaTypes.xml index 39f7f64..b646058 100644 --- a/Common/Defs/Genes/GeneDefs_GenitaliaTypeEndogenes.xml +++ b/Common/Defs/Genes/GeneDefs_GenitaliaTypes.xml @@ -2,7 +2,7 @@ - rjw_genes_genitalia + rjw_genes_genitalia_type
  • GenitalType
  • diff --git a/KNOWN_BUGS.md b/KNOWN_BUGS.md index c190e10..d1153c0 100644 --- a/KNOWN_BUGS.md +++ b/KNOWN_BUGS.md @@ -25,4 +25,35 @@ Error: I added all "no-XXX" genes but my pawn has genitalia on map! Reason: If you go with Full-No-Genitals (No Penis, No Anus, No Breasts, No Vagina) then the pawn spawns without any Genitalia on the map, however then the RJW base-logic runs the sexualizer. -**Workaround**: Have atleast 1 genitalia enabled with Genes, I recommend the anus. \ No newline at end of file +**Workaround**: Have atleast 1 genitalia enabled with Genes, I recommend the anus. + +## Log Pops up for Xenotypes with Female/Male Only Gene + +Error: + +When using a Xenotype with the Female only gene, upon refresh it can open the log with the following (red) statement: + +``` +[RJW] ChangeSex error (PAWNNAME) faction (FACTION). Probably tried to change sex at world gen for royalty implant, skipping +UnityEngine.StackTraceUtility:ExtractStackTrace () +Verse.Log:Error (string) +rjw.ModLog:Error (string) +rjw.GenderHelper:ChangeSex (Verse.Pawn,rjw.GenderHelper/Sex,rjw.GenderHelper/Sex) +rjw.GenderHelper:ChangeSex (Verse.Pawn,System.Action) +RJW_Genes.Gene_FemaleOnly:AdjustPawnToFemale () +RJW_Genes.Gene_FemaleOnly:PostMake () +RimWorld.GeneMaker:MakeGene (Verse.GeneDef,Verse.Pawn) +[... some more ...] +``` + +Reason: + +RJW covers some corner cases when the pawn is changed before creation. + +Current Solution: + +Ignore this. The pawns seem to have the right sex and genitalia, I cannot "catch" the exception as it is only a Log Error. I would need to do harmony patching and ... that seems to be too much. + +Aimed Solution: + +Patch ChangeSex to skip for pawns with the two genes producing this. \ No newline at end of file diff --git a/Source/GeneDefOf.cs b/Source/GeneDefOf.cs index 2c0b42e..959ff01 100644 --- a/Source/GeneDefOf.cs +++ b/Source/GeneDefOf.cs @@ -6,8 +6,10 @@ namespace RJW_Genes [DefOf] public static class GeneDefOf { - public static readonly GeneCategoryDef rjw_genes_genitalia; + public static readonly GeneCategoryDef rjw_genes_genitalia_type; + public static readonly GeneCategoryDef rjw_genes_genitalia_size; public static readonly GeneCategoryDef rjw_genes_gender; + public static readonly GeneCategoryDef rjw_genes_breeding; // Base Genitalia Types public static readonly GeneDef rjw_genes_human_genitalia; @@ -53,14 +55,19 @@ namespace RJW_Genes public static readonly GeneDef rjw_genes_insectincubator; public static readonly GeneDef rjw_genes_insectbreeder; - //Cum + // Cum public static readonly GeneDef rjw_genes_no_cum; public static readonly GeneDef rjw_genes_much_cum; public static readonly GeneDef rjw_genes_very_much_cum; [MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_likes_cumflation; - //[MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_cumflation_immunity; //Does currently not work like this + [MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_cumflation_immunity; //Does currently not work like this - //Reproduction + // Reproduction public static readonly GeneDef rjw_genes_hypersexual; + public static readonly GeneDef rjw_genes_rapist; + public static readonly GeneDef rjw_genes_zoophile; + + // Damage & Side Effects + [MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_elasticity; } } diff --git a/Source/Genes/Breeding/PatchPawnExtensions.cs b/Source/Genes/Breeding/PatchPawnExtensions.cs index f3df7a8..be2e2dc 100644 --- a/Source/Genes/Breeding/PatchPawnExtensions.cs +++ b/Source/Genes/Breeding/PatchPawnExtensions.cs @@ -17,7 +17,7 @@ namespace RJW_Genes { if (!__result) { - __result = GeneUtility.isInsectBreeder(pawn); + __result = GeneUtility.IsInsectBreeder(pawn); } } } diff --git a/Source/Genes/Cum/Patch_Cumflation.cs b/Source/Genes/Cum/Patch_Cumflation.cs new file mode 100644 index 0000000..e8c3496 --- /dev/null +++ b/Source/Genes/Cum/Patch_Cumflation.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Reflection.Emit; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using rjw; +using RimWorld; +using Verse; +using LicentiaLabs; + +namespace RJW_Genes +{ + /// + /// Changes LicentiaLabs (if Present) to not cumflate pawns that are cumflation immune. + /// This code is exercised / loaded in the HarmonyInit. + /// + /// + class Patch_Cumflation + { + // This patch does not need the normal Harmony Targetting, + // as it needs to be added only on demand (See HarmonyInit.cs) + public static bool Prefix(SexProps props) + { + // Harmony Logic skips the original Method after Prefix when "false" is returned + // See https://harmony.pardeike.net/articles/execution.html + + // We skip the whole Cumflation Logic when the Partner is Cumflation Immune + if (props != null && props.partner != null && GeneUtility.IsCumflationImmune(props.partner)) + { + return false; + } + return true; + } + } +} \ No newline at end of file diff --git a/Source/Genes/Damage/Gene_Elasticity.cs b/Source/Genes/Damage/Gene_Elasticity.cs new file mode 100644 index 0000000..b9d3033 --- /dev/null +++ b/Source/Genes/Damage/Gene_Elasticity.cs @@ -0,0 +1,35 @@ +using LicentiaLabs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace RJW_Genes +{ + /// + /// This Gene adds Licentia-Labs Elasticised Hediff to a Pawn. + /// Important: I had a HarmonyPatch first, similar to skipping cumflation, but the Stretching Logic is called quite a lot and for both pawns actually. + /// Hence, I think choosing the Elasticiced Hediff was good as then everything is covered by "Licentia-Logic". + /// + public class Gene_Elasticity : Gene + { + + public override void PostAdd() + { + base.PostAdd(); + this.pawn.health.AddHediff(Licentia.HediffDefs.Elasticised); + } + + public override void PostRemove() + { + Hediff candidate = pawn.health.hediffSet.GetFirstHediffOfDef(Licentia.HediffDefs.Elasticised); + if (candidate != null) + { + pawn.health.RemoveHediff(candidate); + } + base.PostRemove(); + } + } +} diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index 5144aad..44b6e64 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -1,4 +1,5 @@ -using Verse; +using System; +using Verse; namespace RJW_Genes { @@ -22,7 +23,7 @@ namespace RJW_Genes return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator); } - public static bool isInsectBreeder(Pawn pawn) + public static bool IsInsectBreeder(Pawn pawn) { if (pawn.genes == null) { @@ -40,5 +41,23 @@ namespace RJW_Genes } return MaxEggSize; } + + internal static bool IsElastic(Pawn pawn) + { + if (pawn.genes == null) + { + return false; + } + return pawn.genes.HasGene(GeneDefOf.rjw_genes_elasticity); + } + + public static bool IsCumflationImmune(Pawn pawn) + { + if (pawn.genes == null) + { + return false; + } + return pawn.genes.HasGene(GeneDefOf.rjw_genes_cumflation_immunity); + } } } \ No newline at end of file diff --git a/Source/HarmonyInit.cs b/Source/HarmonyInit.cs index c2f288e..1d44812 100644 --- a/Source/HarmonyInit.cs +++ b/Source/HarmonyInit.cs @@ -1,6 +1,6 @@ using Verse; using HarmonyLib; - +using System; namespace RJW_Genes { @@ -11,6 +11,25 @@ namespace RJW_Genes { 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 + harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.Cumflation)), + prefix: new HarmonyMethod(typeof(Patch_Cumflation), nameof(Patch_Cumflation.Prefix))); + } + }))(); + } + catch (TypeLoadException ex) { + // To be expected for people without Licentia Labs + } } } } \ No newline at end of file diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index befe2c2..0582a73 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -29,6 +29,10 @@ ..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll False + + ..\..\licentia-labs\Assemblies\LicentiaLabs.dll + False + ..\..\rjw\1.4\Assemblies\RJW.dll False @@ -60,6 +64,8 @@ + +