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) 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**:

View File

@ -203,9 +203,23 @@
<applicableForMen>true</applicableForMen>
<requiresPenetrativeSex>false</requiresPenetrativeSex>
</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>
</GeneDef>
<GeneDef ParentName="SpecialBase">
<defName>rjw_genes_twinkifier</defName>
@ -230,6 +244,23 @@
<applicableForMen>true</applicableForMen>
<requiresPenetrativeSex>false</requiresPenetrativeSex>
</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>
</GeneDef>

View File

@ -17,8 +17,6 @@ namespace RJW_Genes
public abstract class Gene_GenitaliaResizingGene : RJW_Gene
{
/// <summary>
/// Whether or not the gene was already applied.
/// 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")]
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)
{
@ -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<GeneDef> possibleGenes = new List<GeneDef>() {
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")
};
List<GeneDef> 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<GeneDef> possibleGenes = new List<GeneDef>() {
GeneDefOf.rjw_genes_female_only,
GeneDefOf.rjw_genes_no_penis,
GeneDefOf.rjw_genes_minor_vulnerability,
};
List<GeneDef> possibleGenes = geneAlteringExtension.majorGenes.ToList();
GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null)
{

View File

@ -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<GeneAlteringExtension>();
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<GeneDef> possibleGenes = new List<GeneDef>() {
GeneDefOf.rjw_genes_small_male_genitalia,
DefDatabase<GeneDef>.GetNamed("Beard_NoBeardOnly"),
DefDatabase<GeneDef>.GetNamed("Body_Thin"),
GeneDefOf.rjw_genes_homosexual
};
List<GeneDef> 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<GeneDef> possibleGenes = new List<GeneDef>() {
GeneDefOf.rjw_genes_fertile_anus,
DefDatabase<GeneDef>.GetNamed("Beauty_Pretty"),
DefDatabase<GeneDef>.GetNamed("Delicate"),
GeneDefOf.rjw_genes_minor_vulnerability,
GeneDefOf.rjw_genes_infectious_homosexuality
};
List<GeneDef> possibleGenes = geneAlteringExtension.majorGenes.ToList();
GeneDef chosen = possibleGenes.RandomElement();
if (chosen == null)

View File

@ -190,6 +190,7 @@
<Compile Include="Genes\Special\Abilities\CompAbilityEffect_CocoonWeaver.cs" />
<Compile Include="Genes\Special\Abilities\CompProperties_AbilityCocoonWeaver.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\Patches\Patch_AgeDrain.cs" />
<Compile Include="Genes\Special\Patches\Patch_GeneticSexSwap.cs" />