mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Another important null check for Sextamer
This commit is contained in:
parent
5fe252bd67
commit
48e06ff97f
1 changed files with 6 additions and 4 deletions
|
@ -19,16 +19,18 @@ namespace RJW_Genes
|
||||||
public static void Postfix(SexProps props)
|
public static void Postfix(SexProps props)
|
||||||
{
|
{
|
||||||
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Masturbation or other nieche-cases)
|
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Masturbation or other nieche-cases)
|
||||||
if (props == null || props.pawn == null || !props.hasPartner())
|
if (props == null || props.pawn == null || !props.hasPartner() || props.partner == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Exit for non Animals or Animal on Animal
|
// Exit for non Animals or Animal on Animal
|
||||||
if (!(props.pawn.IsAnimal() || props.partner.IsAnimal() ) )
|
if (!(props.pawn.IsAnimal() || props.partner.IsAnimal() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Pawn animal = props.pawn.IsAnimal() ? props.pawn : props.partner;
|
Pawn animal = props.pawn.IsAnimal() ? props.pawn : props.partner;
|
||||||
Pawn human = props.pawn.IsAnimal() ? props.partner : props.pawn;
|
Pawn human = props.pawn.IsAnimal() ? props.partner : props.pawn;
|
||||||
|
|
||||||
|
// Another Short Sanity Check
|
||||||
|
if (animal == null || human == null ) return;
|
||||||
|
if (human.genes == null) return;
|
||||||
|
|
||||||
if (human.genes.HasActiveGene(GeneDefOf.rjw_genes_sex_tamer))
|
if (human.genes.HasActiveGene(GeneDefOf.rjw_genes_sex_tamer))
|
||||||
{
|
{
|
||||||
// Case 1: Wild Animal - Try to Tame
|
// Case 1: Wild Animal - Try to Tame
|
||||||
|
@ -39,7 +41,7 @@ namespace RJW_Genes
|
||||||
human.interactions.TryInteractWith(animal, InteractionDefOf.TameAttempt);
|
human.interactions.TryInteractWith(animal, InteractionDefOf.TameAttempt);
|
||||||
}
|
}
|
||||||
// Case 2: Colony Animal - Try to Train
|
// Case 2: Colony Animal - Try to Train
|
||||||
else if (animal.Faction == human.Faction && animal.training != null)
|
else if (human.Faction != null && animal.Faction == human.Faction && animal.training != null)
|
||||||
{
|
{
|
||||||
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
|
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
|
||||||
ModLog.Message($"{human} is a sextamer with bestiality on colony animal {animal} - trying to train");
|
ModLog.Message($"{human} is a sextamer with bestiality on colony animal {animal} - trying to train");
|
||||||
|
|
Loading…
Reference in a new issue