mirror of
https://gitgud.io/AbstractConcept/privacy-please.git
synced 2024-08-15 00:03:18 +00:00
Merge branch 'panicWhileDownedFix' into 'master'
fix #6 "Beginning to panic tries to path even if incapacitated" Closes #6 See merge request AbstractConcept/privacy-please!4
This commit is contained in:
commit
629cfde51e
1 changed files with 15 additions and 9 deletions
|
@ -2,7 +2,6 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Verse;
|
using Verse;
|
||||||
using Verse.AI;
|
using Verse.AI;
|
||||||
using Verse.AI.Group;
|
|
||||||
using RimWorld;
|
using RimWorld;
|
||||||
using rjw;
|
using rjw;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -107,7 +106,7 @@ namespace Privacy_Please
|
||||||
if (witness?.Drafted == true || witness?.mindState?.duty?.def.alwaysShowWeapon == true) return;
|
if (witness?.Drafted == true || witness?.mindState?.duty?.def.alwaysShowWeapon == true) return;
|
||||||
|
|
||||||
// Panic reaction
|
// Panic reaction
|
||||||
if (reactionOfWitness == ReactionToSexAct.Panic)
|
if (reactionOfWitness == ReactionToSexAct.Panic && !witness.Downed)
|
||||||
{
|
{
|
||||||
Job job = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
|
Job job = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
|
||||||
|
|
||||||
|
@ -115,24 +114,31 @@ namespace Privacy_Please
|
||||||
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
|
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
|
||||||
witness.jobs.StartJob(job);
|
witness.jobs.StartJob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vomit reaction
|
// Vomit reaction
|
||||||
else if (reactionOfWitness == ReactionToSexAct.Nausea)
|
else if (reactionOfWitness == ReactionToSexAct.Nausea)
|
||||||
{
|
{
|
||||||
Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit);
|
bool vomit = Random.value <= 0.25f;
|
||||||
Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
|
bool flee = !witness.Downed;
|
||||||
|
if (!(flee || vomit)) return;
|
||||||
|
|
||||||
witness.jobs.ClearQueuedJobs();
|
witness.jobs.ClearQueuedJobs();
|
||||||
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
|
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.StartJob(jobVomit);
|
||||||
witness.jobs.jobQueue.EnqueueFirst(jobFlee);
|
doFleeJob = job => witness.jobs.jobQueue.EnqueueFirst(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
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…
Add table
Add a link
Reference in a new issue