mirror of
https://gitgud.io/AbstractConcept/privacy-please.git
synced 2024-08-15 00:03:18 +00:00
fix #6 preemptively for unused vomit reaction
This commit is contained in:
parent
da26772efb
commit
f016c7009d
1 changed files with 14 additions and 8 deletions
|
@ -2,7 +2,6 @@
|
|||
using System.Linq;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using Verse.AI.Group;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using UnityEngine;
|
||||
|
@ -115,24 +114,31 @@ namespace Privacy_Please
|
|||
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
|
||||
witness.jobs.StartJob(job);
|
||||
}
|
||||
|
||||
// Vomit reaction
|
||||
else if (reactionOfWitness == ReactionToSexAct.Nausea)
|
||||
{
|
||||
Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit);
|
||||
Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
|
||||
bool vomit = Random.value <= 0.25f;
|
||||
bool flee = !witness.Downed;
|
||||
if (!(flee || vomit)) return;
|
||||
|
||||
witness.jobs.ClearQueuedJobs();
|
||||
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
|
||||
|
||||
if (Random.value <= 0.25f)
|
||||
System.Action<Job> doFleeJob;
|
||||
if (vomit)
|
||||
{
|
||||
Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit);
|
||||
witness.jobs.StartJob(jobVomit);
|
||||
witness.jobs.jobQueue.EnqueueFirst(jobFlee);
|
||||
doFleeJob = job => witness.jobs.jobQueue.EnqueueFirst(job);
|
||||
}
|
||||
|
||||
else
|
||||
{ witness.jobs.StartJob(jobFlee); }
|
||||
{ doFleeJob = job => witness.jobs.StartJob(job); }
|
||||
|
||||
if (flee)
|
||||
{
|
||||
Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
|
||||
doFleeJob(jobFlee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue