Fixed #2 by checking if pawn is already a futa before adding extra genitalia

This commit is contained in:
Vegapnk 2023-01-15 08:14:18 +01:00
parent be7f280ae7
commit fd88a13848
2 changed files with 23 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Fixes:
- Issue with Breast-Size (#8) fixed by lowercasing breast-match (Shabakur)
- Error on Game Load when Licentia Genes are tried to be added to Xenotypes for players without Licentia (#5)
- Futa Gene only triggers if Pawn is not a futa already (#2)
# 1.0.1 (2022-12-20)

View File

@ -13,6 +13,12 @@ namespace RJW_Genes
{
base.PostMake();
// If the Pawn is already a Futa, do not do anything. Can Happen by Base-RJW Spawn Chance or potentially races / other mods.
if (IsAlreadyFuta(pawn))
{
return;
}
if (GenderUtility.IsFemale(pawn) && additional_genital == null)
{
createAndAddPenis();
@ -27,6 +33,12 @@ namespace RJW_Genes
{
base.PostAdd();
// If the Pawn is already a Futa, do not do anything. Can Happen by Base-RJW Spawn Chance or potentially races / other mods.
if (IsAlreadyFuta(pawn))
{
return;
}
if (pawn.gender == Gender.Female && additional_genital == null)
{
createAndAddPenis();
@ -79,5 +91,15 @@ namespace RJW_Genes
pawn.health.AddHediff(additional_genital, partBPR);
}
private static bool IsAlreadyFuta(Pawn pawn)
{
if (pawn == null)
return false;
if (!Genital_Helper.has_genitals(pawn))
return false;
return
(Genital_Helper.has_penis_fertile(pawn) || Genital_Helper.has_penis_infertile(pawn))
&& Genital_Helper.has_vagina(pawn) ;
}
}
}