mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Move gene properties and cycle disabled genes to ModExtensions
This commit is contained in:
parent
7b00579969
commit
fcbc19825e
8 changed files with 125 additions and 28 deletions
Binary file not shown.
|
@ -21,6 +21,11 @@
|
|||
<iconPath>UI/Genes/Placeholder</iconPath>
|
||||
<biostatMet>1</biostatMet>
|
||||
<displayOrderInCategory>10</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<eggLifeTimeFactor>0.75</eggLifeTimeFactor>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef ParentName="Menstruation_EggLifetime">
|
||||
|
@ -30,6 +35,11 @@
|
|||
<iconPath>UI/Genes/Placeholder</iconPath>
|
||||
<biostatMet>-1</biostatMet>
|
||||
<displayOrderInCategory>12</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<eggLifeTimeFactor>2.0</eggLifeTimeFactor>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef ParentName="Menstruation_EggLifetime">
|
||||
|
@ -40,6 +50,11 @@
|
|||
<biostatMet>-2</biostatMet>
|
||||
<biostatCpx>1</biostatCpx>
|
||||
<displayOrderInCategory>16</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<eggLifeTimeFactor>4.0</eggLifeTimeFactor>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef Name="Menstruation_Estrus" Abstract="True">
|
||||
|
@ -56,6 +71,11 @@
|
|||
<iconPath>UI/Genes/Placeholder</iconPath>
|
||||
<biostatMet>1</biostatMet>
|
||||
<displayOrderInCategory>20</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<neverEstrus>true</neverEstrus>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef ParentName="Menstruation_Estrus">
|
||||
|
@ -66,6 +86,11 @@
|
|||
<biostatMet>-1</biostatMet>
|
||||
<biostatCpx>1</biostatCpx>
|
||||
<displayOrderInCategory>25</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<alwaysEstrus>true</alwaysEstrus>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef Name="Menstruation_Ovulation" Abstract="True">
|
||||
|
@ -82,6 +107,11 @@
|
|||
<iconPath>UI/Genes/Placeholder</iconPath>
|
||||
<biostatMet>-1</biostatMet>
|
||||
<displayOrderInCategory>30</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<ovulationFactor>2</ovulationFactor>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef ParentName="Menstruation_Ovulation">
|
||||
|
@ -91,6 +121,11 @@
|
|||
<iconPath>UI/Genes/Placeholder</iconPath>
|
||||
<biostatMet>-1</biostatMet>
|
||||
<displayOrderInCategory>35</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<ovulationFactor>4</ovulationFactor>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef>
|
||||
|
@ -101,6 +136,11 @@
|
|||
<iconPath>UI/Genes/Placeholder</iconPath>
|
||||
<biostatMet>-1</biostatMet>
|
||||
<displayOrderInCategory>40</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class ="RJW_Menstruation.MenstruationModExtension">
|
||||
<noBleeding>true</noBleeding>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<!-- Pheromones? -->
|
||||
|
|
59
1.4/Patches/CycleDisabledGenes.xml
Normal file
59
1.4/Patches/CycleDisabledGenes.xml
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Patch>
|
||||
<Operation Class="PatchOperationFindMod">
|
||||
<mods>
|
||||
<li>Alpha Genes</li>
|
||||
</mods>
|
||||
<match Class="PatchOperationAddModExtension">
|
||||
<xpath>/Defs/GeneDef[defName="AG_Egglaying"]</xpath>
|
||||
<value>
|
||||
<li Class="RJW_Menstruation.MenstruationModExtension">
|
||||
<disableCycle>true</disableCycle>
|
||||
</li>
|
||||
</value>
|
||||
</match>
|
||||
</Operation>
|
||||
|
||||
<Operation Class="PatchOperationFindMod">
|
||||
<mods>
|
||||
<li>Vanilla Races Expanded - Saurid</li>
|
||||
</mods>
|
||||
<match Class="PatchOperationAddModExtension">
|
||||
<xpath>/Defs/GeneDef[defName="VRESaurids_Oviparous"]</xpath>
|
||||
<value>
|
||||
<li Class="RJW_Menstruation.MenstruationModExtension">
|
||||
<disableCycle>true</disableCycle>
|
||||
</li>
|
||||
</value>
|
||||
</match>
|
||||
</Operation>
|
||||
|
||||
<Operation Class="PatchOperationFindMod">
|
||||
<mods>
|
||||
<li>Vanilla Races Expanded - Phytokin</li>
|
||||
</mods>
|
||||
<match Class="PatchOperationAddModExtension">
|
||||
<xpath>/Defs/GeneDef[defName="VRE_SaplingBirth"]</xpath>
|
||||
<value>
|
||||
<li Class="RJW_Menstruation.MenstruationModExtension">
|
||||
<disableCycle>true</disableCycle>
|
||||
</li>
|
||||
</value>
|
||||
</match>
|
||||
</Operation>
|
||||
|
||||
<Operation Class="PatchOperationFindMod">
|
||||
<mods>
|
||||
<li>Erin's Corvyia</li>
|
||||
</mods>
|
||||
<match Class="PatchOperationAddModExtension">
|
||||
<xpath>/Defs/GeneDef[defName="ERN_EggLayer"]</xpath>
|
||||
<value>
|
||||
<li Class="RJW_Menstruation.MenstruationModExtension">
|
||||
<disableCycle>true</disableCycle>
|
||||
</li>
|
||||
</value>
|
||||
</match>
|
||||
</Operation>
|
||||
</Patch>
|
|
@ -682,19 +682,15 @@ namespace RJW_Menstruation
|
|||
|
||||
if (Pawn.genes == null || !ModsConfig.BiotechActive) return;
|
||||
|
||||
foreach (GeneDef geneDef in Pawn.genes.GenesListForReading.Select(gene => gene.def))
|
||||
foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Select(gene => gene.def.GetModExtension<MenstruationModExtension>()))
|
||||
{
|
||||
if (geneDef == VariousDefOf.ShortEggLifetime) eggLifeSpanTicks = eggLifeSpanTicks * 3 / 4;
|
||||
else if (geneDef == VariousDefOf.DoubleEggLifetime) eggLifeSpanTicks *= 2;
|
||||
else if (geneDef == VariousDefOf.QuadEggLifetime) eggLifeSpanTicks *= 4;
|
||||
if (extension == null) continue;
|
||||
|
||||
else if (geneDef == VariousDefOf.NeverEstrus) estrusLevel = EstrusLevel.None;
|
||||
else if (geneDef == VariousDefOf.FullEstrus) estrusLevel = EstrusLevel.Visible;
|
||||
|
||||
else if (geneDef == VariousDefOf.DoubleOvulation) ovulationFactor = 2f;
|
||||
else if (geneDef == VariousDefOf.QuadOvulation) ovulationFactor = 4f;
|
||||
|
||||
else if (geneDef == VariousDefOf.NoBleeding) noBleeding = true;
|
||||
eggLifeSpanTicks = (int)(eggLifeSpanTicks * extension.eggLifeTimeFactor);
|
||||
if (extension.alwaysEstrus) estrusLevel = EstrusLevel.Visible;
|
||||
else if (extension.neverEstrus) estrusLevel = EstrusLevel.None;
|
||||
ovulationFactor *= extension.ovulationFactor;
|
||||
if (extension.noBleeding) noBleeding = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -398,6 +398,7 @@ namespace RJW_Menstruation
|
|||
if (!Configurations.EnableAnimalCycle && pawn.IsAnimal()) return false;
|
||||
if (pawn.GetComp<CompEggLayer>() != null) return false;
|
||||
if (pawn.RaceHasOviPregnancy()) return false;
|
||||
|
||||
if (ModsConfig.BiotechActive && pawn.genes != null &&
|
||||
pawn.genes.GenesListForReading.Select(gene => gene.def).Intersect(VariousDefOf.EggLayerGenes).Any()) return false;
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using Verse;
|
||||
|
||||
namespace RJW_Menstruation
|
||||
{
|
||||
public class MenstruationModExtension : DefModExtension
|
||||
{
|
||||
public float eggLifeTimeFactor = 1.0f;
|
||||
public bool neverEstrus = false;
|
||||
public bool alwaysEstrus = false;
|
||||
public float ovulationFactor = 1.0f;
|
||||
public bool noBleeding = false;
|
||||
|
||||
public bool disableCycle = false;
|
||||
}
|
||||
}
|
|
@ -74,6 +74,7 @@
|
|||
<Compile Include="HediffComps\MenstruationUtility.cs" />
|
||||
<Compile Include="Hediff_Estrus.cs" />
|
||||
<Compile Include="IngestionOutcomeDoers.cs" />
|
||||
<Compile Include="MenstruationModExtension.cs" />
|
||||
<Compile Include="Patch\Biotech_Patch.cs" />
|
||||
<Compile Include="Patch\GC_Patch.cs" />
|
||||
<Compile Include="Patch\Gizmo_Patch.cs" />
|
||||
|
|
|
@ -45,14 +45,6 @@ namespace RJW_Menstruation
|
|||
public static readonly RecordDef AmountofCreampied = DefDatabase<RecordDef>.GetNamed("AmountofCreampied");
|
||||
public static readonly RecordDef AmountofFertilizedEggs = DefDatabase<RecordDef>.GetNamed("AmountofFertilizedEggs");
|
||||
public static readonly TaleDef TaleCameInside = DefDatabase<TaleDef>.GetNamed("CameInside");
|
||||
public static readonly GeneDef ShortEggLifetime = DefDatabase<GeneDef>.GetNamed("Menstruation_ShortEggLifetime");
|
||||
public static readonly GeneDef DoubleEggLifetime = DefDatabase<GeneDef>.GetNamed("Menstruation_DoubleEggLifetime");
|
||||
public static readonly GeneDef QuadEggLifetime = DefDatabase<GeneDef>.GetNamed("Menstruation_QuadEggLifetime");
|
||||
public static readonly GeneDef NeverEstrus = DefDatabase<GeneDef>.GetNamed("Menstruation_NeverEstrus");
|
||||
public static readonly GeneDef FullEstrus = DefDatabase<GeneDef>.GetNamed("Menstruation_FullEstrus");
|
||||
public static readonly GeneDef DoubleOvulation = DefDatabase<GeneDef>.GetNamed("Menstruation_DoubleOvulation");
|
||||
public static readonly GeneDef QuadOvulation = DefDatabase<GeneDef>.GetNamed("Menstruation_QuadOvulation");
|
||||
public static readonly GeneDef NoBleeding = DefDatabase<GeneDef>.GetNamed("Menstruation_NoBleeding");
|
||||
|
||||
private static List<ThingDef> allraces = null;
|
||||
private static List<PawnKindDef> allkinds = null;
|
||||
|
@ -157,14 +149,7 @@ namespace RJW_Menstruation
|
|||
get
|
||||
{
|
||||
if (egglayergenes != null) return egglayergenes;
|
||||
egglayergenes = new HashSet<GeneDef>
|
||||
{
|
||||
DefDatabase<GeneDef>.GetNamedSilentFail("AG_EggLaying"), // Alpha Genes
|
||||
DefDatabase<GeneDef>.GetNamedSilentFail("VRESaurids_Oviparous"), // VE Saurid
|
||||
DefDatabase<GeneDef>.GetNamedSilentFail("VRE_SaplingBirth"), // VE Phytokin
|
||||
DefDatabase<GeneDef>.GetNamedSilentFail("ERN_EggLayer"), // Erin's Corvyia
|
||||
};
|
||||
egglayergenes.Remove(null);
|
||||
egglayergenes = DefDatabase<GeneDef>.AllDefsListForReading.Where(geneDef => geneDef.GetModExtension<MenstruationModExtension>()?.disableCycle ?? false).ToHashSet();
|
||||
|
||||
return egglayergenes;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue