rjw-genes/Source/Genes/ExtraGenitalia/Gene_NoVagina.cs

55 lines
1.3 KiB
C#
Raw Normal View History

2022-11-14 16:47:43 +00:00
using Verse;
using rjw;
using RimWorld;
namespace RJW_Genes
{
public class Gene_NoVagina : RJW_Gene
2022-11-14 16:47:43 +00:00
{
internal Hediff removed_vagina;
2023-04-28 06:24:18 +00:00
2022-11-14 16:47:43 +00:00
public override void PostMake()
{
base.PostMake();
// Vaginas are only removed for female pawns!
if (GenderUtility.IsFemale(pawn) && removed_vagina == null)
2022-11-14 16:47:43 +00:00
{
RemoveButStoreVagina();
}
}
public override void PostAdd()
{
base.PostAdd();
// Vaginas are only removed for female pawns!
if (GenderUtility.IsFemale(pawn) && removed_vagina == null)
2022-11-14 16:47:43 +00:00
{
RemoveButStoreVagina();
}
}
public override void PostRemove()
{
base.PostRemove();
if(removed_vagina != null)
pawn.health.AddHediff(removed_vagina);
}
internal void RemoveButStoreVagina()
{
var partBPR = Genital_Helper.get_genitalsBPR(pawn);
Hediff vaginaToRemove = Genital_Helper.get_AllPartsHediffList(pawn).FindLast(x => Genital_Helper.is_vagina(x));
if(vaginaToRemove != null)
{
removed_vagina = vaginaToRemove;
pawn.health.RemoveHediff(vaginaToRemove);
}
}
}
}