mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Made Twinkifier and Feminizer Genes xml configurable
This commit is contained in:
parent
eb5e3bce81
commit
ba75f6b636
7 changed files with 81 additions and 41 deletions
18
Source/Genes/Special/Defs/GeneAlteringExtension.cs
Normal file
18
Source/Genes/Special/Defs/GeneAlteringExtension.cs
Normal 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;
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue