rjw-genes/1.6/Source/Genes/ExtraGenitalia/Gene_ExtraAnus.cs
Telanda-DDS 7f6dc2a668 - Added in Elasticity support for Cumpilation and Eltoro Stretching.
- Updated Breeding Pulse c# with more debugging information.
- Updated Vanilla Genes Expanded Genie with updated function call.
- Removed Licentia XML & method calls from Gene_Elasticity.cs
- Fixed MatingCall Ability & checked to make sure Pheromone Spit was still functional.
- Fixed incorrect mod requirement for sex curiosity Gene.
2025-07-24 13:41:47 +10:00

83 lines
2.2 KiB
C#

using Verse;
using rjw;
using RimWorld;
using System.Linq;
namespace RJW_Genes
{
public class Gene_ExtraAnus : RJW_Gene
{
internal Hediff additional_anus;
public override void PostMake()
{
base.PostMake();
// Some sources add Genes before they fire, e.g. Character Editor
// This should harden the gene, to solve #19
if (HasAlreadyTwoAnus())
{
return;
}
if (additional_anus == null)
{
CreateAndAddAnus();
}
}
public override void PostAdd()
{
if (pawn.kindDef == null) return; //Added to catch Rimworld creating statues of pawns.
base.PostAdd();
// Some sources add Genes before they fire, e.g. Character Editor
// This should harden the gene, to solve #19
if (HasAlreadyTwoAnus())
{
return;
}
if (additional_anus == null)
{
CreateAndAddAnus();
}
}
public override void PostRemove()
{
base.PostRemove();
if(additional_anus != null)
pawn.health.RemoveHediff(additional_anus);
}
internal void CreateAndAddAnus()
{
var correctGene = GenitaliaUtility.GetGenitaliaTypeGeneForPawn(pawn);
var anusDef = GenitaliaUtility.GetAnusForGene(correctGene);
var partBPR = Genital_Helper.get_anusBPR(pawn);
additional_anus = HediffMaker.MakeHediff(anusDef, pawn);
var CompHediff = additional_anus.TryGetComp<rjw.HediffComp_SexPart>();
if (CompHediff != null)
{
CompHediff.Init(pawn);
CompHediff.UpdateSeverity();
}
pawn.health.AddHediff(additional_anus, partBPR);
}
internal bool HasAlreadyTwoAnus()
{
if (pawn == null)
return false;
var possible_breasts =
Genital_Helper.get_AllPartsHediffList(pawn).Where(t => Genital_Helper.is_anus(t));
return possible_breasts.Count() >= 2;
}
}
}