2022-11-14 14:55:52 +00:00
|
|
|
|
using Verse;
|
|
|
|
|
using rjw;
|
|
|
|
|
using RimWorld;
|
|
|
|
|
|
|
|
|
|
namespace RJW_Genes
|
|
|
|
|
{
|
2022-11-20 16:33:50 +00:00
|
|
|
|
public class Gene_ExtraPenis : RJW_Gene
|
2022-11-14 14:55:52 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
internal Hediff additional_penis;
|
|
|
|
|
|
|
|
|
|
public override void PostMake()
|
|
|
|
|
{
|
|
|
|
|
base.PostMake();
|
|
|
|
|
|
|
|
|
|
// Penis are only added for male pawns!
|
2022-11-20 16:33:50 +00:00
|
|
|
|
if (GenderUtility.IsMale(pawn) && additional_penis == null)
|
2022-11-14 14:55:52 +00:00
|
|
|
|
{
|
2022-11-20 16:33:50 +00:00
|
|
|
|
CreateAndAddPenis();
|
2022-11-14 14:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void PostAdd()
|
|
|
|
|
{
|
|
|
|
|
base.PostAdd();
|
|
|
|
|
|
|
|
|
|
// Penis are only added for male pawns!
|
2022-11-20 16:33:50 +00:00
|
|
|
|
if (GenderUtility.IsMale(pawn) && additional_penis == null)
|
2022-11-14 14:55:52 +00:00
|
|
|
|
{
|
2022-11-20 16:33:50 +00:00
|
|
|
|
CreateAndAddPenis();
|
2022-11-14 14:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void PostRemove()
|
|
|
|
|
{
|
|
|
|
|
base.PostRemove();
|
|
|
|
|
if(additional_penis != null)
|
|
|
|
|
pawn.health.RemoveHediff(additional_penis);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-20 16:33:50 +00:00
|
|
|
|
internal void CreateAndAddPenis()
|
2022-11-14 14:55:52 +00:00
|
|
|
|
{
|
|
|
|
|
var correctGene = GenitaliaUtility.GetGenitaliaTypeGeneForPawn(pawn);
|
2022-11-14 16:47:43 +00:00
|
|
|
|
HediffDef penisDef = GenitaliaUtility.GetPenisForGene(correctGene);
|
2022-11-14 14:55:52 +00:00
|
|
|
|
var partBPR = Genital_Helper.get_genitalsBPR(pawn);
|
|
|
|
|
additional_penis = HediffMaker.MakeHediff(penisDef, pawn);
|
|
|
|
|
|
|
|
|
|
var CompHediff = additional_penis.TryGetComp<rjw.CompHediffBodyPart>();
|
|
|
|
|
if (CompHediff != null)
|
|
|
|
|
{
|
|
|
|
|
CompHediff.initComp(pawn);
|
|
|
|
|
CompHediff.updatesize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pawn.health.AddHediff(additional_penis, partBPR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|