public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams) { JobQueue jobQueue = pawn.jobs.jobQueue; bool flag = pawn.Downed || jobQueue.AnyCanBeginNow(pawn, this.inBedOnly); if (flag) { while (jobQueue.Count > 0 && !jobQueue.Peek().job.CanBeginNow(pawn, this.inBedOnly)) { QueuedJob queuedJob = jobQueue.Dequeue(); pawn.ClearReservationsForJob(queuedJob.job); if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(" Throwing away queued job that I cannot begin now: " + queuedJob.job); } } } ThinkResult result; if (jobQueue.Count > 0 && jobQueue.Peek().job.CanBeginNow(pawn, this.inBedOnly)) { QueuedJob queuedJob2 = jobQueue.Dequeue(); if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(" Returning queued job: " + queuedJob2.job); } result = new ThinkResult(queuedJob2.job, this, queuedJob2.tag, true); } else { result = ThinkResult.NoJob; } return(result); }
public void EndCurrentOrQueuedJob(Job job, JobCondition condition) { if (debugLog) { DebugLogEvent("EndJob [" + job + "] condition=" + condition); } QueuedJob queuedJob = jobQueue.Extract(job); if (queuedJob != null) { pawn.ClearReservationsForJob(queuedJob.job); } if (curJob == job) { EndCurrentJob(condition); } }
public void EndJob(Job job, JobCondition condition) { if (this.debugLog) { this.DebugLogEvent("EndJob [" + job + "] condition=" + condition); } QueuedJob queuedJob = this.jobQueue.Extract(job); if (queuedJob != null) { this.pawn.ClearReservationsForJob(queuedJob.job); } if (this.curJob == job) { this.EndCurrentJob(condition, true); } }
public void EndCurrentOrQueuedJob(Job job, JobCondition condition, bool canReturnToPool = true) { if (debugLog) { DebugLogEvent(string.Concat("EndJob [", job, "] condition=", condition)); } QueuedJob queuedJob = jobQueue.Extract(job); if (queuedJob != null) { pawn.ClearReservationsForJob(queuedJob.job); if (canReturnToPool) { JobMaker.ReturnToPool(queuedJob.job); } } if (curJob == job) { EndCurrentJob(condition, startNewJob: true, canReturnToPool); } }
public void EndJob(Job job, JobCondition condition) { if (this.debugLog) { this.DebugLogEvent(string.Concat(new object[] { "EndJob [", job, "] condition=", condition })); } QueuedJob queuedJob = this.jobQueue.Extract(job); if (queuedJob != null) { this.pawn.ClearReservationsForJob(queuedJob.job); } if (this.curJob == job) { this.EndCurrentJob(condition, true); } }