Made Twinkifier and Feminizer Genes xml configurable

This commit is contained in:
Vegapnk 2024-07-16 16:26:27 +02:00
parent eb5e3bce81
commit ba75f6b636
7 changed files with 81 additions and 41 deletions

View file

@ -101,8 +101,7 @@ and might try to add a gene that already exists - then nothing happens.
- (Major) No Penis - (Major) No Penis
- (Major) Minor Vulnerability - (Major) Minor Vulnerability
These are currently hardcoded but I can change them on popular demand. You can configure all genes, as well as their application chance, in the Genes` XML.
In general minor changes are only cosmetic and wont change metabolism.
*Why are these changes Genetic?* *Why are these changes Genetic?*
Because this is the genes mod, and I find things here quite robust. Because this is the genes mod, and I find things here quite robust.
@ -175,6 +174,11 @@ You can now support me with [buying me a coffee](https://buymeacoffee.com/vegapn
The mod will remain free, open source and I will not hide or lock any features. The mod will remain free, open source and I will not hide or lock any features.
Its just meant if you want to drop me a tip. Its just meant if you want to drop me a tip.
**Since Beta-1** (11-07-2024)
- Made the Feminizer and Twinkifier configurable with XML.
# 2.1.0 (27-06-2024) # 2.1.0 (27-06-2024)
**Additions**: **Additions**:

View file

@ -203,9 +203,23 @@
<applicableForMen>true</applicableForMen> <applicableForMen>true</applicableForMen>
<requiresPenetrativeSex>false</requiresPenetrativeSex> <requiresPenetrativeSex>false</requiresPenetrativeSex>
</li> </li>
<li Class="RJW_Genes.GeneAlteringExtension">
<majorGenes>
<li>rjw_genes_female_only</li>
<li>rjw_genes_no_penis</li>
<li>rjw_genes_minor_vulnerability</li>
</majorGenes>
<minorGenes>
<li>rjw_genes_small_male_genitalia</li>
<li>rjw_genes_big_breasts</li>
<li>Beard_NoBeardOnly</li>
<li>Hair_LongOnly</li>
</minorGenes>
<minorApplicationChance>0.25</minorApplicationChance>
<majorApplicationChance>0.1</majorApplicationChance>
</li>
</modExtensions> </modExtensions>
</GeneDef> </GeneDef>
<GeneDef ParentName="SpecialBase"> <GeneDef ParentName="SpecialBase">
<defName>rjw_genes_twinkifier</defName> <defName>rjw_genes_twinkifier</defName>
@ -230,6 +244,23 @@
<applicableForMen>true</applicableForMen> <applicableForMen>true</applicableForMen>
<requiresPenetrativeSex>false</requiresPenetrativeSex> <requiresPenetrativeSex>false</requiresPenetrativeSex>
</li> </li>
<li Class="RJW_Genes.GeneAlteringExtension">
<majorGenes>
<li>rjw_genes_fertile_anus</li>
<li>Beauty_Pretty</li>
<li>Delicate</li>
<li>rjw_genes_minor_vulnerability</li>
<li>rjw_genes_infectious_homosexuality</li>
</majorGenes>
<minorGenes>
<li>rjw_genes_small_male_genitalia</li>
<li>Beard_NoBeardOnly</li>
<li>Body_Thin</li>
<li>rjw_genes_homosexual</li>
</minorGenes>
<minorApplicationChance>0.25</minorApplicationChance>
<majorApplicationChance>0.1</majorApplicationChance>
</li>
</modExtensions> </modExtensions>
</GeneDef> </GeneDef>

View file

@ -17,8 +17,6 @@ namespace RJW_Genes
public abstract class Gene_GenitaliaResizingGene : RJW_Gene public abstract class Gene_GenitaliaResizingGene : RJW_Gene
{ {
/// <summary> /// <summary>
/// Whether or not the gene was already applied. /// Whether or not the gene was already applied.
/// If not, it is checked on every birthday and will be applied accordingly. /// If not, it is checked on every birthday and will be applied accordingly.

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class GeneAlteringExtension : DefModExtension
{
public List<GeneDef> minorGenes;
public List<GeneDef> majorGenes;
public float minorApplicationChance;
public float majorApplicationChance;
}
}

View file

@ -16,8 +16,8 @@ namespace RJW_Genes
[HarmonyPatch(typeof(SexUtility), "Aftersex")] [HarmonyPatch(typeof(SexUtility), "Aftersex")]
public static class Patch_Feminizer public static class Patch_Feminizer
{ {
const float MINOR_APPLICATION_CHANCE = 0.25f; // = 25% to have a minor transformation
const float MAJOR_APPLICATION_CHANCE = 0.10f; // = 10% to have a major transformation static GeneAlteringExtension geneAlteringExtension = GeneDefOf.rjw_genes_feminizer.GetModExtension<GeneAlteringExtension>();
public static void Postfix(SexProps props) public static void Postfix(SexProps props)
{ {
@ -26,6 +26,12 @@ namespace RJW_Genes
if (props.pawn.IsAnimal() || props.partner.IsAnimal()) if (props.pawn.IsAnimal() || props.partner.IsAnimal())
return; return;
if (geneAlteringExtension == null)
{
ModLog.Warning("Did not find a (well-formed) GeneAlteringExtension for Feminizer");
return;
}
ApplyFeminization(props.pawn); ApplyFeminization(props.pawn);
ApplyFeminization(props.partner); ApplyFeminization(props.partner);
} }
@ -44,12 +50,12 @@ namespace RJW_Genes
{ {
case float f when f > 0.8f: case float f when f > 0.8f:
{ {
if (Random.NextDouble() < MAJOR_APPLICATION_CHANCE) if (Random.NextDouble() < geneAlteringExtension.majorApplicationChance)
MajorChange(pawn); MajorChange(pawn);
} break; } break;
case float f when f > 0.6f: case float f when f > 0.6f:
{ {
if (Random.NextDouble() < MINOR_APPLICATION_CHANCE) if (Random.NextDouble() < geneAlteringExtension.minorApplicationChance)
MinorChange(pawn); MinorChange(pawn);
} break; } break;
default: default:
@ -57,19 +63,11 @@ namespace RJW_Genes
ModLog.Debug($"Tried to feminize {pawn} - severity of feminization was too low ({hediff.def} @ {hediff.Severity} - {hediff.Label})") ; ModLog.Debug($"Tried to feminize {pawn} - severity of feminization was too low ({hediff.def} @ {hediff.Severity} - {hediff.Label})") ;
} break; } break;
} }
} }
private static void MinorChange(Pawn pawn) private static void MinorChange(Pawn pawn)
{ {
List<GeneDef> possibleGenes = new List<GeneDef>() { List<GeneDef> possibleGenes = geneAlteringExtension.minorGenes.ToList();
GeneDefOf.rjw_genes_small_male_genitalia,
GeneDefOf.rjw_genes_big_breasts,
GeneDefOf.rjw_genes_no_cum,
DefDatabase<GeneDef>.GetNamed("Beard_NoBeardOnly"),
DefDatabase<GeneDef>.GetNamed("Hair_LongOnly")
};
GeneDef chosen = possibleGenes.RandomElement(); GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null) if (chosen == null)
{ {
@ -90,12 +88,7 @@ namespace RJW_Genes
private static void MajorChange(Pawn pawn) private static void MajorChange(Pawn pawn)
{ {
List<GeneDef> possibleGenes = new List<GeneDef>() { List<GeneDef> possibleGenes = geneAlteringExtension.majorGenes.ToList();
GeneDefOf.rjw_genes_female_only,
GeneDefOf.rjw_genes_no_penis,
GeneDefOf.rjw_genes_minor_vulnerability,
};
GeneDef chosen = possibleGenes.RandomElement(); GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null) if (chosen == null)
{ {

View file

@ -16,8 +16,8 @@ namespace RJW_Genes
[HarmonyPatch(typeof(SexUtility), "Aftersex")] [HarmonyPatch(typeof(SexUtility), "Aftersex")]
public static class Patch_Twinkifier public static class Patch_Twinkifier
{ {
const float MINOR_APPLICATION_CHANCE = 0.25f; // = 25% to have a minor transformation
const float MAJOR_APPLICATION_CHANCE = 0.10f; // = 10% to have a major transformation static GeneAlteringExtension geneAlteringExtension = GeneDefOf.rjw_genes_twinkifier.GetModExtension<GeneAlteringExtension>();
public static void Postfix(SexProps props) public static void Postfix(SexProps props)
{ {
@ -26,6 +26,12 @@ namespace RJW_Genes
if (props.pawn.IsAnimal() || props.partner.IsAnimal()) if (props.pawn.IsAnimal() || props.partner.IsAnimal())
return; return;
if (geneAlteringExtension == null)
{
ModLog.Warning("Did not find a (well-formed) GeneAlteringExtension for Twinkifier");
return;
}
ApplyTwinkification(props.pawn); ApplyTwinkification(props.pawn);
ApplyTwinkification(props.partner); ApplyTwinkification(props.partner);
} }
@ -44,12 +50,12 @@ namespace RJW_Genes
{ {
case float f when f > 0.8f: case float f when f > 0.8f:
{ {
if (Random.NextDouble() < MAJOR_APPLICATION_CHANCE) if (Random.NextDouble() < geneAlteringExtension.majorApplicationChance)
MajorChange(pawn); MajorChange(pawn);
} break; } break;
case float f when f > 0.6f: case float f when f > 0.6f:
{ {
if (Random.NextDouble() < MINOR_APPLICATION_CHANCE) if (Random.NextDouble() < geneAlteringExtension.minorApplicationChance)
MinorChange(pawn); MinorChange(pawn);
} break; } break;
default: default:
@ -62,12 +68,7 @@ namespace RJW_Genes
private static void MinorChange(Pawn pawn) private static void MinorChange(Pawn pawn)
{ {
List<GeneDef> possibleGenes = new List<GeneDef>() { List<GeneDef> possibleGenes = geneAlteringExtension.minorGenes.ToList();
GeneDefOf.rjw_genes_small_male_genitalia,
DefDatabase<GeneDef>.GetNamed("Beard_NoBeardOnly"),
DefDatabase<GeneDef>.GetNamed("Body_Thin"),
GeneDefOf.rjw_genes_homosexual
};
GeneDef chosen = possibleGenes.RandomElement(); GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null) if (chosen == null)
@ -89,13 +90,7 @@ namespace RJW_Genes
private static void MajorChange(Pawn pawn) private static void MajorChange(Pawn pawn)
{ {
List<GeneDef> possibleGenes = new List<GeneDef>() { List<GeneDef> possibleGenes = geneAlteringExtension.majorGenes.ToList();
GeneDefOf.rjw_genes_fertile_anus,
DefDatabase<GeneDef>.GetNamed("Beauty_Pretty"),
DefDatabase<GeneDef>.GetNamed("Delicate"),
GeneDefOf.rjw_genes_minor_vulnerability,
GeneDefOf.rjw_genes_infectious_homosexuality
};
GeneDef chosen = possibleGenes.RandomElement(); GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null) if (chosen == null)

View file

@ -190,6 +190,7 @@
<Compile Include="Genes\Special\Abilities\CompAbilityEffect_CocoonWeaver.cs" /> <Compile Include="Genes\Special\Abilities\CompAbilityEffect_CocoonWeaver.cs" />
<Compile Include="Genes\Special\Abilities\CompProperties_AbilityCocoonWeaver.cs" /> <Compile Include="Genes\Special\Abilities\CompProperties_AbilityCocoonWeaver.cs" />
<Compile Include="Genes\Special\Defs\AgeTransferExtension.cs" /> <Compile Include="Genes\Special\Defs\AgeTransferExtension.cs" />
<Compile Include="Genes\Special\Defs\GeneAlteringExtension.cs" />
<Compile Include="Genes\Special\Defs\HormonalSalivaExtension.cs" /> <Compile Include="Genes\Special\Defs\HormonalSalivaExtension.cs" />
<Compile Include="Genes\Special\Patches\Patch_AgeDrain.cs" /> <Compile Include="Genes\Special\Patches\Patch_AgeDrain.cs" />
<Compile Include="Genes\Special\Patches\Patch_GeneticSexSwap.cs" /> <Compile Include="Genes\Special\Patches\Patch_GeneticSexSwap.cs" />