Cleanups and Draft for #27

This commit is contained in:
Vegapnk 2023-04-28 08:24:18 +02:00
parent e62dcd23ee
commit 41a95c3c5e
11 changed files with 100 additions and 26 deletions

View file

@ -4,7 +4,6 @@
<displayCategory>rjw_genes_genitalia_extras</displayCategory>
</GeneDef>
<GeneDef ParentName="GeneExtraGenitaliaBase">
<defName>rjw_genes_extra_penis</defName>
<label>extra penis</label>
@ -127,5 +126,19 @@
<li>BreastAmount</li>
</exclusionTags>
</GeneDef>
<!--
See Comment in `RJW_Genes.Gene_UdderBreasts` why this is currently commented out.
<GeneDef ParentName="GeneExtraGenitaliaBase">
<defName>rjw_genes_udder</defName>
<label>udder</label>
<description>Carriers of this gene have udders instead of breasts.</description>
<iconPath>Things/Mote/Heart</iconPath>
<geneClass>RJW_Genes.Gene_UdderBreasts</geneClass>
<displayOrderInCategory>711</displayOrderInCategory>
<exclusionTags>
<li>BreastAmount</li>
</exclusionTags>
</GeneDef>
-->
</Defs>

View file

@ -72,4 +72,5 @@
<displayOrderInCategory>808</displayOrderInCategory>
</GeneDef>
</Defs>

View file

@ -151,7 +151,7 @@
<GeneDef>
<defName>rjw_genes_spawn_spelopede</defName>
<label>Spelopede Dispenser</label>
<labelShortAdj>cocooner</labelShortAdj>
<labelShortAdj>spelopede</labelShortAdj>
<description>Carriers of this gene can generate tame spelopedes. Higher psychic-sensitivity will spawn more spelopedes.</description>
<iconPath>World/WorldObjects/Expanding/Insects</iconPath>
<displayOrderInCategory>12</displayOrderInCategory>

View file

@ -1,6 +1,5 @@
using Verse;
using rjw;
using RimWorld;
namespace RJW_Genes
{
@ -54,7 +53,7 @@ namespace RJW_Genes
internal void AddFeaturelessBreast()
{
var partBPR = Genital_Helper.get_breastsBPR(pawn);
this.added_nipples = pawn.health.AddHediff(Genital_Helper.featureless_chest, partBPR);
added_nipples = pawn.health.AddHediff(Genital_Helper.featureless_chest, partBPR);
}
}

View file

@ -9,9 +9,6 @@ namespace RJW_Genes
internal Hediff removed_anus;
// TODO: This gene only works if another Gene was set specifying the genitalia.
// If it is added later, it still works, but on creation it needs a different
// TODO: If all Genitalia are removed by genes, RJW adds some to the pawns at spawn
public override void PostMake()
{
base.PostMake();

View file

@ -52,15 +52,5 @@ namespace RJW_Genes
}
}
/*
/// <summary>
/// Adds a "rjw.featurelesschest", which means nipples but nothing else (like male human pawns do).
/// </summary>
internal void AddFeaturelessBreast()
{
var partBPR = Genital_Helper.get_breastsBPR(pawn);
//this.added_nipples = pawn.health.AddHediff(Genital_Helper.featureless_chest, partBPR);
}
*/
}
}

View file

@ -9,9 +9,6 @@ namespace RJW_Genes
internal Hediff removed_penis;
// TODO: This gene only works if another Gene was set specifying the genitalia.
// If it is added later, it still works, but on creation it needs a different
// TODO: If all Genitalia are removed by genes, RJW adds some to the pawns at spawn
public override void PostMake()
{
base.PostMake();

View file

@ -9,9 +9,6 @@ namespace RJW_Genes
internal Hediff removed_vagina;
// TODO: This gene only works if another Gene was set specifying the genitalia.
// If it is added later, it still works, but on creation it needs a different
// TODO: If all Genitalia are removed by genes, RJW adds some to the pawns at spawn
public override void PostMake()
{
base.PostMake();

View file

@ -0,0 +1,78 @@
using rjw;
using Verse;
namespace RJW_Genes
{
/// <summary>
/// Removes breasts for female (and trap, futa) pawns and adds Udders.
/// Wished for in Issue #27.
///
/// TODO: Currently, the sexualizer over-writes the added udders and just adds another pair of breasts!
/// I commented out the gene in .xml for now.
/// </summary>
public class Gene_UdderBreasts : RJW_Gene
{
Hediff removed_breasts;
Hediff added_udders;
public override void PostMake()
{
base.PostMake();
// Breasts are replaced for female,trap and futa pawns
if ( removed_breasts == null
&& (GenderUtility.IsFemale(pawn) || GenderHelper.GetSex(pawn) == GenderHelper.Sex.futa || GenderHelper.GetSex(pawn) == GenderHelper.Sex.trap)
)
{
RemoveButStoreBreasts();
AddUdders();
}
}
public override void PostAdd()
{
base.PostAdd();
// Breasts are replaced for female,trap and futa pawns
if (removed_breasts == null
&& (GenderUtility.IsFemale(pawn) || GenderHelper.GetSex(pawn) == GenderHelper.Sex.futa || GenderHelper.GetSex(pawn) == GenderHelper.Sex.trap)
)
{
RemoveButStoreBreasts();
AddUdders();
}
}
public override void PostRemove()
{
base.PostRemove();
// Re-Add the old breasts
if (removed_breasts != null)
pawn.health.AddHediff(removed_breasts);
if (added_udders != null)
pawn.health.RemoveHediff(added_udders);
}
internal void RemoveButStoreBreasts()
{
var partBPR = Genital_Helper.get_breastsBPR(pawn);
Hediff breastsToRemove = Genital_Helper.get_AllPartsHediffList(pawn).FindLast(x => GenitaliaUtility.IsBreasts(x));
if (breastsToRemove != null)
{
removed_breasts = breastsToRemove;
pawn.health.RemoveHediff(breastsToRemove);
}
}
internal void AddUdders()
{
BodyPartRecord bpr = Genital_Helper.get_uddersBPR(pawn);
added_udders = pawn.health.AddHediff(Genital_Helper.udder_breasts, bpr);
}
}
}

View file

@ -99,6 +99,7 @@ namespace RJW_Genes
case "rjw_genes_demonic_genitalia": return Genital_Helper.average_breasts;
case "rjw_genes_dragon_genitalia": return Genital_Helper.average_breasts;
case "rjw_genes_slime_genitalia": return Genital_Helper.slime_breasts;
case "rjw_genes_udder_breasts": return Genital_Helper.udder_breasts;
case "rjw_genes_ovipositor_genitalia": return Genital_Helper.average_breasts;
default: return Genital_Helper.generic_breasts;

View file

@ -43,6 +43,7 @@
<Compile Include="GeneDefOf.cs" />
<Compile Include="Genes\Breeding\Gene_MechBreeder.cs" />
<Compile Include="Genes\Breeding\PatchMechBirth.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_UdderBreasts.cs" />
<Compile Include="Genes\Hive\Defs\HiveOffspringChanceDef.cs" />
<Compile Include="Genes\Hive\Genes\Gene_FerventOvipositor.cs" />
<Compile Include="Genes\Hive\Genes\Gene_InsectIncubator.cs" />