Added check for rare null ref exception of partner in large orgies

This commit is contained in:
c0ffee 2021-05-14 09:57:20 -07:00
parent 8b13a27272
commit d165e0487b
5 changed files with 6 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>RJW-Events</identifier>
<version>0.1.0</version>
<version>0.1.1</version>
</Manifest>

BIN
Assemblies/RJW-Events.dll Normal file

Binary file not shown.

View file

@ -32,7 +32,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\Modpacks\Mods\836308268\1.2\Assemblies\0Harmony.dll</HintPath>
<HintPath>..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
@ -40,7 +40,7 @@
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\RJW\1.2\Assemblies\RJW.dll</HintPath>
<HintPath>..\rjw-master\1.2\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />

View file

@ -24,6 +24,7 @@ namespace RJW_Events
base.setup_ticks();
JobDef PartnerJob = DefDatabase<JobDef>.GetNamed("GettinOrgySex", true);
this.FailOnDespawnedOrNull(this.iTarget);
this.FailOn(() => this.Partner == null);
this.FailOn(() => !this.Partner.health.capacities.CanBeAwake);
this.FailOn(() => this.pawn.IsFighting());
this.FailOn(() => this.Partner.IsFighting());
@ -53,7 +54,7 @@ namespace RJW_Events
initAction = delegate ()
{
if(Partner.CurJob.def != PartnerJob)
if(Partner?.jobs != null && Partner?.CurJob?.def != null && Partner.CurJob.def != PartnerJob)
{
Job newJob = JobMaker.MakeJob(PartnerJob, this.pawn, this.Partner);
this.Partner.jobs.StartJob(newJob, JobCondition.InterruptForced, null, false, true, null, null, false, false);

View file

@ -35,6 +35,7 @@ namespace RJW_Events
this.ticks_between_hearts -= 25;
}
this.FailOnDespawnedOrNull(this.iTarget);
this.FailOn(() => this.Partner == null);
this.FailOn(() => !(Partner.jobs.curDriver is JobDriver_Sex));
this.FailOn(() => !base.Partner.health.capacities.CanBeAwake);
this.FailOn(() => this.pawn.Drafted);