Added Elasticity Gene and Zoophile Trait Gene

This commit is contained in:
Vegapnk 2022-11-26 21:32:32 +01:00
parent f17da08394
commit 84c0ab012e
15 changed files with 227 additions and 19 deletions

Binary file not shown.

View file

@ -4,30 +4,55 @@
<!-- Note: It is very important that rjw_genes_gender has a higher priority than the other genes <!-- Note: It is very important that rjw_genes_gender has a higher priority than the other genes
That way they run in the correct order. That way they run in the correct order.
If the Gender Change happens after e.g. genitalia change, it will produce errors. If the Gender Change happens after e.g. genitalia change, it will produce errors.
General Order:
1. Gender
2. Genitalia Types
3. Extra Genitalia
4. Genitalia Sizes
5. Others
--> -->
<GeneCategoryDef> <GeneCategoryDef>
<defName>rjw_genes_gender</defName> <defName>rjw_genes_gender</defName>
<label>Gender</label> <label>Gender</label>
<displayPriorityInXenotype>20</displayPriorityInXenotype> <displayPriorityInXenotype>21</displayPriorityInXenotype>
</GeneCategoryDef> </GeneCategoryDef>
<GeneCategoryDef> <GeneCategoryDef>
<defName>rjw_genes_genitalia</defName> <defName>rjw_genes_genitalia_type</defName>
<label>Genitalia</label> <label>Genitalia Types</label>
<displayPriorityInXenotype>16</displayPriorityInXenotype> <displayPriorityInXenotype>19</displayPriorityInXenotype>
</GeneCategoryDef>
<GeneCategoryDef>
<defName>rjw_genes_genitalia_extras</defName>
<label>Genitalia Amounts</label>
<displayPriorityInXenotype>17</displayPriorityInXenotype>
</GeneCategoryDef>
<GeneCategoryDef>
<defName>rjw_genes_genitalia_size</defName>
<label>Genitalia Size / Attributes</label>
<displayPriorityInXenotype>15</displayPriorityInXenotype>
</GeneCategoryDef> </GeneCategoryDef>
<GeneCategoryDef> <GeneCategoryDef>
<defName>rjw_genes_breeding</defName> <defName>rjw_genes_breeding</defName>
<label>Breeding</label> <label>Breeding</label>
<displayPriorityInXenotype>15</displayPriorityInXenotype> <displayPriorityInXenotype>13</displayPriorityInXenotype>
</GeneCategoryDef> </GeneCategoryDef>
<GeneCategoryDef> <GeneCategoryDef>
<defName>rjw_genes_cum</defName> <defName>rjw_genes_cum</defName>
<label>Cum</label> <label>Cum</label>
<displayPriorityInXenotype>14</displayPriorityInXenotype> <displayPriorityInXenotype>12</displayPriorityInXenotype>
</GeneCategoryDef>
<GeneCategoryDef>
<defName>rjw_damage</defName>
<label>Genital Related Damage</label>
<displayPriorityInXenotype>11</displayPriorityInXenotype>
</GeneCategoryDef> </GeneCategoryDef>
</Defs> </Defs>

View file

@ -29,4 +29,18 @@
<displayCategory>rjw_genes_breeding</displayCategory> <displayCategory>rjw_genes_breeding</displayCategory>
</GeneDef> </GeneDef>
<GeneDef>
<defName>rjw_genes_zoophile</defName>
<label>Zoophile</label>
<displayCategory>rjw_genes_breeding</displayCategory>
<description>Xenotypes with this Gene are Zoophile.</description>
<iconPath>Genes/Icons/Placeholder</iconPath>
<displayOrderInCategory>54</displayOrderInCategory>
<forcedTraits>
<li>
<def>Zoophile</def>
</li>
</forcedTraits>
</GeneDef>
</Defs> </Defs>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<GeneDef MayRequire="LustLicentia.RJWLabs">
<defName>rjw_genes_elasticity</defName>
<label>Elasticity</label>
<displayCategory>rjw_damage</displayCategory>
<description>This Xenotype cannot get stretched by huge penetrators.</description>
<iconPath>Genes/Icons/Placeholder</iconPath>
<geneClass>RJW_Genes.Gene_Elasticity</geneClass>
<displayOrderInCategory>1</displayOrderInCategory>
</GeneDef>
</Defs>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Defs> <Defs>
<GeneDef Name="GeneExtraGenitaliaBase" Abstract="True"> <GeneDef Name="GeneExtraGenitaliaBase" Abstract="True">
<displayCategory>rjw_genes_genitalia</displayCategory> <displayCategory>rjw_genes_genitalia_extras</displayCategory>
</GeneDef> </GeneDef>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Defs> <Defs>
<GeneDef Name="GeneGenitaliaSizeBase" Abstract="True"> <GeneDef Name="GeneGenitaliaSizeBase" Abstract="True">
<displayCategory>rjw_genes_genitalia</displayCategory> <displayCategory>rjw_genes_genitalia_size</displayCategory>
<!--These Genes need to be loaded quite last, otherwise e.g. genitalia types will re-roll and overrule genitalia size--> <!--These Genes need to be loaded quite last, otherwise e.g. genitalia types will re-roll and overrule genitalia size-->
</GeneDef> </GeneDef>

View file

@ -2,7 +2,7 @@
<Defs> <Defs>
<GeneDef Name="GeneGenitalTypeBase" Abstract="True"> <GeneDef Name="GeneGenitalTypeBase" Abstract="True">
<displayCategory>rjw_genes_genitalia</displayCategory> <displayCategory>rjw_genes_genitalia_type</displayCategory>
<exclusionTags> <exclusionTags>
<li>GenitalType</li> <li>GenitalType</li>
</exclusionTags> </exclusionTags>

View file

@ -26,3 +26,34 @@ Reason: If you go with Full-No-Genitals (No Penis, No Anus, No Breasts, No Vagin
however then the RJW base-logic runs the sexualizer. however then the RJW base-logic runs the sexualizer.
**Workaround**: Have atleast 1 genitalia enabled with Genes, I recommend the anus. **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.

View file

@ -6,8 +6,10 @@ namespace RJW_Genes
[DefOf] [DefOf]
public static class GeneDefOf 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_gender;
public static readonly GeneCategoryDef rjw_genes_breeding;
// Base Genitalia Types // Base Genitalia Types
public static readonly GeneDef rjw_genes_human_genitalia; public static readonly GeneDef rjw_genes_human_genitalia;
@ -58,9 +60,14 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_much_cum; public static readonly GeneDef rjw_genes_much_cum;
public static readonly GeneDef rjw_genes_very_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_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_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;
} }
} }

View file

@ -17,7 +17,7 @@ namespace RJW_Genes
{ {
if (!__result) if (!__result)
{ {
__result = GeneUtility.isInsectBreeder(pawn); __result = GeneUtility.IsInsectBreeder(pawn);
} }
} }
} }

View file

@ -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
{
/// <summary>
/// Changes LicentiaLabs (if Present) to not cumflate pawns that are cumflation immune.
/// This code is exercised / loaded in the HarmonyInit.
/// </summary>
///
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;
}
}
}

View file

@ -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
{
/// <summary>
/// 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".
/// </summary>
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();
}
}
}

View file

@ -1,4 +1,5 @@
using Verse; using System;
using Verse;
namespace RJW_Genes namespace RJW_Genes
{ {
@ -22,7 +23,7 @@ namespace RJW_Genes
return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator); return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator);
} }
public static bool isInsectBreeder(Pawn pawn) public static bool IsInsectBreeder(Pawn pawn)
{ {
if (pawn.genes == null) if (pawn.genes == null)
{ {
@ -40,5 +41,23 @@ namespace RJW_Genes
} }
return MaxEggSize; 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);
}
} }
} }

View file

@ -1,6 +1,6 @@
using Verse; using Verse;
using HarmonyLib; using HarmonyLib;
using System;
namespace RJW_Genes namespace RJW_Genes
{ {
@ -11,6 +11,25 @@ namespace RJW_Genes
{ {
Harmony harmony = new Harmony("rjw_genes"); Harmony harmony = new Harmony("rjw_genes");
harmony.PatchAll(); 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
}
} }
} }
} }

View file

@ -29,6 +29,10 @@
<HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath> <HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="LicentiaLabs">
<HintPath>..\..\licentia-labs\Assemblies\LicentiaLabs.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RJW"> <Reference Include="RJW">
<HintPath>..\..\rjw\1.4\Assemblies\RJW.dll</HintPath> <HintPath>..\..\rjw\1.4\Assemblies\RJW.dll</HintPath>
<Private>False</Private> <Private>False</Private>
@ -60,6 +64,8 @@
<Compile Include="Genes\Cum\Gene_VeryMuchCum.cs" /> <Compile Include="Genes\Cum\Gene_VeryMuchCum.cs" />
<Compile Include="Genes\Cum\Gene_MuchCum.cs" /> <Compile Include="Genes\Cum\Gene_MuchCum.cs" />
<Compile Include="Genes\Cum\Gene_NoCum.cs" /> <Compile Include="Genes\Cum\Gene_NoCum.cs" />
<Compile Include="Genes\Damage\Gene_Elasticity.cs" />
<Compile Include="Genes\Cum\Patch_Cumflation.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_ExtraBreasts.cs" /> <Compile Include="Genes\ExtraGenitalia\Gene_ExtraBreasts.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_ExtraAnus.cs" /> <Compile Include="Genes\ExtraGenitalia\Gene_ExtraAnus.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_Futa.cs" /> <Compile Include="Genes\ExtraGenitalia\Gene_Futa.cs" />