GenitaliaUtility tweaks

- Un-hardcoded GetXForGene methods, allowing genderbending genes to affect more part types
  * Left GetBreastsForGene alone for now since genital genes don't currently seem to change breasts when added initially
- Refactored GetGenitaliaTypeGeneForPawn to use shared gene class instead of requiring defName take a specific form
This commit is contained in:
a flock of birds 2024-05-26 23:57:57 +01:00
parent bbf7bb2847
commit 1a132da48a
2 changed files with 6 additions and 38 deletions

Binary file not shown.

View file

@ -19,7 +19,7 @@ namespace RJW_Genes
foreach (var gene in pawn.genes.GenesListForReading) foreach (var gene in pawn.genes.GenesListForReading)
{ {
if (gene.def.defName.Contains("rjw_genes") && gene.def.defName.EndsWith("_genitalia")) if (gene is Gene_GenitaliaType)
if (!gene.Overridden) if (!gene.Overridden)
return gene.def; return gene.def;
} }
@ -32,18 +32,7 @@ namespace RJW_Genes
if (gene == null) if (gene == null)
return Genital_Helper.average_penis; return Genital_Helper.average_penis;
switch (gene.defName) return gene.GetModExtension<GenitaliaTypeExtension>()?.Penis ?? Genital_Helper.average_penis;
{
case "rjw_genes_equine_genitalia": return Genital_Helper.equine_penis;
case "rjw_genes_canine_genitalia": return Genital_Helper.canine_penis;
case "rjw_genes_feline_genitalia": return Genital_Helper.feline_penis;
case "rjw_genes_demonic_genitalia": return Genital_Helper.demon_penis;
case "rjw_genes_dragon_genitalia": return Genital_Helper.dragon_penis;
case "rjw_genes_slime_genitalia": return Genital_Helper.slime_penis;
case "rjw_genes_ovipositor_genitalia": return Genital_Helper.ovipositorM;
default: return Genital_Helper.average_penis;
}
} }
@ -52,37 +41,16 @@ namespace RJW_Genes
if (gene == null) if (gene == null)
return Genital_Helper.average_vagina; return Genital_Helper.average_vagina;
switch (gene.defName) return gene.GetModExtension<GenitaliaTypeExtension>()?.Vagina ?? Genital_Helper.average_vagina;
{
case "rjw_genes_equine_genitalia": return Genital_Helper.equine_vagina;
case "rjw_genes_canine_genitalia": return Genital_Helper.canine_vagina;
case "rjw_genes_feline_genitalia": return Genital_Helper.feline_vagina;
case "rjw_genes_demonic_genitalia": return Genital_Helper.demon_vagina;
case "rjw_genes_dragon_genitalia": return Genital_Helper.dragon_vagina;
case "rjw_genes_slime_genitalia": return Genital_Helper.slime_vagina;
case "rjw_genes_ovipositor_genitalia": return Genital_Helper.ovipositorF;
default: return Genital_Helper.average_vagina;
}
} }
public static HediffDef GetAnusForGene(GeneDef gene) public static HediffDef GetAnusForGene(GeneDef gene)
{ {
if (gene == null) if (gene == null)
return Genital_Helper.average_anus; return Genital_Helper.average_anus;
switch (gene.defName)
{ //TODO: Do I want the default to be generic or average for feline,equine and canine?
//TODO: Do I want the default to be generic or average for feline,equine and canine? return gene.GetModExtension<GenitaliaTypeExtension>()?.Anus ?? Genital_Helper.average_anus;
case "rjw_genes_equine_genitalia": return Genital_Helper.average_anus;
case "rjw_genes_canine_genitalia": return Genital_Helper.average_anus;
case "rjw_genes_feline_genitalia": return Genital_Helper.average_anus;
case "rjw_genes_demonic_genitalia": return Genital_Helper.demon_anus;
case "rjw_genes_dragon_genitalia": return Genital_Helper.average_anus;
case "rjw_genes_slime_genitalia": return Genital_Helper.slime_anus;
case "rjw_genes_ovipositor_genitalia": return Genital_Helper.insect_anus;
default: return Genital_Helper.generic_anus;
}
} }
public static HediffDef GetBreastsForGene(GeneDef gene) public static HediffDef GetBreastsForGene(GeneDef gene)