diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4bb498e..41e4e07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -101,8 +101,7 @@ and might try to add a gene that already exists - then nothing happens.
- (Major) No Penis
- (Major) Minor Vulnerability
-These are currently hardcoded but I can change them on popular demand.
-In general minor changes are only cosmetic and wont change metabolism.
+You can configure all genes, as well as their application chance, in the Genes` XML.
*Why are these changes Genetic?*
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.
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)
**Additions**:
diff --git a/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml b/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml
index d715892..fff6f60 100644
--- a/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml
+++ b/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml
@@ -203,9 +203,23 @@
true
false
+
+
+ rjw_genes_female_only
+ rjw_genes_no_penis
+ rjw_genes_minor_vulnerability
+
+
+ rjw_genes_small_male_genitalia
+ rjw_genes_big_breasts
+ Beard_NoBeardOnly
+ Hair_LongOnly
+
+ 0.25
+ 0.1
+
-
rjw_genes_twinkifier
@@ -230,6 +244,23 @@
true
false
+
+
+ rjw_genes_fertile_anus
+ Beauty_Pretty
+ Delicate
+ rjw_genes_minor_vulnerability
+ rjw_genes_infectious_homosexuality
+
+
+ rjw_genes_small_male_genitalia
+ Beard_NoBeardOnly
+ Body_Thin
+ rjw_genes_homosexual
+
+ 0.25
+ 0.1
+
diff --git a/Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs b/Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs
index adae607..b7de209 100644
--- a/Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs
+++ b/Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs
@@ -17,8 +17,6 @@ namespace RJW_Genes
public abstract class Gene_GenitaliaResizingGene : RJW_Gene
{
-
-
///
/// Whether or not the gene was already applied.
/// If not, it is checked on every birthday and will be applied accordingly.
diff --git a/Source/Genes/Special/Defs/GeneAlteringExtension.cs b/Source/Genes/Special/Defs/GeneAlteringExtension.cs
new file mode 100644
index 0000000..64b40d4
--- /dev/null
+++ b/Source/Genes/Special/Defs/GeneAlteringExtension.cs
@@ -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 minorGenes;
+ public List majorGenes;
+
+ public float minorApplicationChance;
+ public float majorApplicationChance;
+ }
+}
diff --git a/Source/Genes/Special/Patches/Patch_Feminizer.cs b/Source/Genes/Special/Patches/Patch_Feminizer.cs
index 952f63a..4259654 100644
--- a/Source/Genes/Special/Patches/Patch_Feminizer.cs
+++ b/Source/Genes/Special/Patches/Patch_Feminizer.cs
@@ -16,8 +16,8 @@ namespace RJW_Genes
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
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();
public static void Postfix(SexProps props)
{
@@ -26,6 +26,12 @@ namespace RJW_Genes
if (props.pawn.IsAnimal() || props.partner.IsAnimal())
return;
+ if (geneAlteringExtension == null)
+ {
+ ModLog.Warning("Did not find a (well-formed) GeneAlteringExtension for Feminizer");
+ return;
+ }
+
ApplyFeminization(props.pawn);
ApplyFeminization(props.partner);
}
@@ -44,12 +50,12 @@ namespace RJW_Genes
{
case float f when f > 0.8f:
{
- if (Random.NextDouble() < MAJOR_APPLICATION_CHANCE)
+ if (Random.NextDouble() < geneAlteringExtension.majorApplicationChance)
MajorChange(pawn);
} break;
case float f when f > 0.6f:
{
- if (Random.NextDouble() < MINOR_APPLICATION_CHANCE)
+ if (Random.NextDouble() < geneAlteringExtension.minorApplicationChance)
MinorChange(pawn);
} break;
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})") ;
} break;
}
-
}
private static void MinorChange(Pawn pawn)
{
- List possibleGenes = new List() {
- GeneDefOf.rjw_genes_small_male_genitalia,
- GeneDefOf.rjw_genes_big_breasts,
- GeneDefOf.rjw_genes_no_cum,
- DefDatabase.GetNamed("Beard_NoBeardOnly"),
- DefDatabase.GetNamed("Hair_LongOnly")
- };
-
+ List possibleGenes = geneAlteringExtension.minorGenes.ToList();
GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null)
{
@@ -90,12 +88,7 @@ namespace RJW_Genes
private static void MajorChange(Pawn pawn)
{
- List possibleGenes = new List() {
- GeneDefOf.rjw_genes_female_only,
- GeneDefOf.rjw_genes_no_penis,
- GeneDefOf.rjw_genes_minor_vulnerability,
- };
-
+ List possibleGenes = geneAlteringExtension.majorGenes.ToList();
GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null)
{
diff --git a/Source/Genes/Special/Patches/Patch_Twinkifier.cs b/Source/Genes/Special/Patches/Patch_Twinkifier.cs
index 87b43bc..b7205fb 100644
--- a/Source/Genes/Special/Patches/Patch_Twinkifier.cs
+++ b/Source/Genes/Special/Patches/Patch_Twinkifier.cs
@@ -16,8 +16,8 @@ namespace RJW_Genes
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
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();
public static void Postfix(SexProps props)
{
@@ -26,6 +26,12 @@ namespace RJW_Genes
if (props.pawn.IsAnimal() || props.partner.IsAnimal())
return;
+ if (geneAlteringExtension == null)
+ {
+ ModLog.Warning("Did not find a (well-formed) GeneAlteringExtension for Twinkifier");
+ return;
+ }
+
ApplyTwinkification(props.pawn);
ApplyTwinkification(props.partner);
}
@@ -44,12 +50,12 @@ namespace RJW_Genes
{
case float f when f > 0.8f:
{
- if (Random.NextDouble() < MAJOR_APPLICATION_CHANCE)
+ if (Random.NextDouble() < geneAlteringExtension.majorApplicationChance)
MajorChange(pawn);
} break;
case float f when f > 0.6f:
{
- if (Random.NextDouble() < MINOR_APPLICATION_CHANCE)
+ if (Random.NextDouble() < geneAlteringExtension.minorApplicationChance)
MinorChange(pawn);
} break;
default:
@@ -62,12 +68,7 @@ namespace RJW_Genes
private static void MinorChange(Pawn pawn)
{
- List possibleGenes = new List() {
- GeneDefOf.rjw_genes_small_male_genitalia,
- DefDatabase.GetNamed("Beard_NoBeardOnly"),
- DefDatabase.GetNamed("Body_Thin"),
- GeneDefOf.rjw_genes_homosexual
- };
+ List possibleGenes = geneAlteringExtension.minorGenes.ToList();
GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null)
@@ -89,13 +90,7 @@ namespace RJW_Genes
private static void MajorChange(Pawn pawn)
{
- List possibleGenes = new List() {
- GeneDefOf.rjw_genes_fertile_anus,
- DefDatabase.GetNamed("Beauty_Pretty"),
- DefDatabase.GetNamed("Delicate"),
- GeneDefOf.rjw_genes_minor_vulnerability,
- GeneDefOf.rjw_genes_infectious_homosexuality
- };
+ List possibleGenes = geneAlteringExtension.majorGenes.ToList();
GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null)
diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj
index 5182089..3b8204f 100644
--- a/Source/Rjw-Genes.csproj
+++ b/Source/Rjw-Genes.csproj
@@ -190,6 +190,7 @@
+