コード例 #1
0
ファイル: ThinkResult.cs プロジェクト: potsh/RimWorld
 public ThinkResult(Job job, ThinkNode sourceNode, JobTag?tag = default(JobTag?), bool fromQueue = false)
 {
     jobInt         = job;
     sourceNodeInt  = sourceNode;
     this.tag       = tag;
     this.fromQueue = fromQueue;
 }
コード例 #2
0
        private void CheckLeaveJoinableLordBecauseJobIssued(ThinkResult result)
        {
            if (result.IsValid && result.SourceNode != null)
            {
                Lord lord = this.pawn.GetLord();
                if (lord != null && lord.LordJob is LordJob_VoluntarilyJoinable)
                {
                    bool      flag      = false;
                    ThinkNode thinkNode = result.SourceNode;
                    while (!thinkNode.leaveJoinableLordIfIssuesJob)
                    {
                        thinkNode = thinkNode.parent;
                        if (thinkNode == null)
                        {
IL_7C:
                            if (flag)
                            {
                                lord.Notify_PawnLost(this.pawn, PawnLostCondition.LeftVoluntarily);
                                return;
                            }
                            return;
                        }
                    }
                    flag = true;
                    goto IL_7C;
                }
            }
        }
コード例 #3
0
 public ThinkResult(Job job, ThinkNode sourceNode, JobTag?tag = null, bool fromQueue = false)
 {
     this.jobInt        = job;
     this.sourceNodeInt = sourceNode;
     this.tag           = tag;
     this.fromQueue     = fromQueue;
 }
コード例 #4
0
ファイル: Job.cs プロジェクト: KraigXu/GameProject
 public void Clear()
 {
     def                            = null;
     targetA                        = LocalTargetInfo.Invalid;
     targetB                        = LocalTargetInfo.Invalid;
     targetC                        = LocalTargetInfo.Invalid;
     targetQueueA                   = null;
     targetQueueB                   = null;
     count                          = -1;
     countQueue                     = null;
     loadID                         = -1;
     startTick                      = -1;
     expiryInterval                 = -1;
     checkOverrideOnExpire          = false;
     playerForced                   = false;
     placedThings                   = null;
     maxNumMeleeAttacks             = int.MaxValue;
     maxNumStaticAttacks            = int.MaxValue;
     locomotionUrgency              = LocomotionUrgency.Jog;
     haulMode                       = HaulMode.Undefined;
     bill                           = null;
     commTarget                     = null;
     plantDefToSow                  = null;
     verbToUse                      = null;
     haulOpportunisticDuplicates    = false;
     exitMapOnArrival               = false;
     failIfCantJoinOrCreateCaravan  = false;
     killIncappedTarget             = false;
     ignoreForbidden                = false;
     ignoreDesignations             = false;
     canBash                        = false;
     canUseRangedWeapon             = true;
     haulDroppedApparel             = false;
     restUntilHealed                = false;
     ignoreJoyTimeAssignment        = false;
     doUntilGatheringEnded          = false;
     overeat                        = false;
     attackDoorIfTargetLost         = false;
     takeExtraIngestibles           = 0;
     expireRequiresEnemiesNearby    = false;
     lord                           = null;
     collideWithPawns               = false;
     forceSleep                     = false;
     interaction                    = null;
     endIfCantShootTargetFromCurPos = false;
     endIfCantShootInMelee          = false;
     checkEncumbrance               = false;
     followRadius                   = 0f;
     endAfterTendedOnce             = false;
     quest                          = null;
     mote                           = null;
     jobGiverThinkTree              = null;
     jobGiver                       = null;
     workGiverDef                   = null;
     if (cachedDriver != null)
     {
         cachedDriver.job = null;
     }
     cachedDriver = null;
 }
コード例 #5
0
        private void CheckLeaveJoinableLordBecauseJobIssued(ThinkResult result)
        {
            if (!result.IsValid || result.SourceNode == null)
            {
                return;
            }
            Lord lord = pawn.GetLord();

            if (lord == null || !(lord.LordJob is LordJob_VoluntarilyJoinable))
            {
                return;
            }
            bool      flag      = false;
            ThinkNode thinkNode = result.SourceNode;

            do
            {
                if (thinkNode.leaveJoinableLordIfIssuesJob)
                {
                    flag = true;
                    break;
                }
                thinkNode = thinkNode.parent;
            }while (thinkNode != null);
            if (flag)
            {
                lord.Notify_PawnLost(pawn, PawnLostCondition.LeftVoluntarily);
            }
        }
コード例 #6
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    this.$current = this;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    enumerator = base.ChildrenRecursive.GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 2u:
                    break;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        c             = enumerator.Current;
                        this.$current = c;
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                this.$PC = -1;
                return(false);
            }
コード例 #7
0
ファイル: Pawn_MindState.cs プロジェクト: potsh/RimWorld
 public void Reset(bool clearInspiration = false)
 {
     mentalStateHandler.Reset();
     mentalBreaker.Reset();
     if (clearInspiration)
     {
         inspirationHandler.Reset();
     }
     activeInt               = true;
     lastJobTag              = JobTag.Misc;
     lastIngestTick          = -99999;
     nextApparelOptimizeTick = -99999;
     lastJobGiver            = null;
     lastJobGiverThinkTree   = null;
     lastGivenWorkType       = null;
     canFleeIndividual       = true;
     exitMapAfterTick        = -99999;
     lastDisturbanceTick     = -99999;
     forcedGotoPosition      = IntVec3.Invalid;
     knownExploder           = null;
     wantsToTradeWithColony  = false;
     lastMannedThing         = null;
     canLovinTick            = -99999;
     canSleepTick            = -99999;
     meleeThreat             = null;
     lastMeleeThreatHarmTick = -99999;
     lastEngageTargetTick    = -99999;
     lastAttackTargetTick    = -99999;
     lastAttackedTarget      = LocalTargetInfo.Invalid;
     enemyTarget             = null;
     duty = null;
     thinkData.Clear();
     lastAssignedInteractTime    = -99999;
     interactionsToday           = 0;
     lastInventoryRawFoodUseTick = 0;
     priorityWork.Clear();
     nextMoveOrderIsWait             = true;
     lastTakeCombatEnhancingDrugTick = -99999;
     lastHarmTick                              = -99999;
     anyCloseHostilesRecently                  = false;
     WillJoinColonyIfRescued                   = false;
     WildManEverReachedOutside                 = false;
     timesGuestTendedToByPlayer                = 0;
     lastSelfTendTick                          = -99999;
     spawnedByInfestationThingComp             = false;
     lastPredatorHuntingPlayerNotificationTick = -99999;
 }
コード例 #8
0
        public virtual ThinkNode DeepCopy(bool resolve = true)
        {
            ThinkNode thinkNode = (ThinkNode)Activator.CreateInstance(base.GetType());

            for (int i = 0; i < this.subNodes.Count; i++)
            {
                thinkNode.subNodes.Add(this.subNodes[i].DeepCopy(resolve));
            }
            thinkNode.priority = this.priority;
            thinkNode.leaveJoinableLordIfIssuesJob = this.leaveJoinableLordIfIssuesJob;
            thinkNode.uniqueSaveKeyInt             = this.uniqueSaveKeyInt;
            if (resolve)
            {
                thinkNode.ResolveSubnodesAndRecur();
            }
            ThinkTreeKeyAssigner.AssignSingleKey(thinkNode, 0);
            return(thinkNode);
        }
コード例 #9
0
 public void Reset()
 {
     this.mentalStateHandler.Reset();
     this.mentalBreaker.Reset();
     this.inspirationHandler.Reset();
     this.activeInt               = true;
     this.lastJobTag              = JobTag.Misc;
     this.lastIngestTick          = -99999;
     this.nextApparelOptimizeTick = -99999;
     this.lastJobGiver            = null;
     this.lastJobGiverThinkTree   = null;
     this.lastGivenWorkType       = null;
     this.canFleeIndividual       = true;
     this.exitMapAfterTick        = -99999;
     this.lastDisturbanceTick     = -99999;
     this.forcedGotoPosition      = IntVec3.Invalid;
     this.knownExploder           = null;
     this.wantsToTradeWithColony  = false;
     this.lastMannedThing         = null;
     this.canLovinTick            = -99999;
     this.canSleepTick            = -99999;
     this.meleeThreat             = null;
     this.lastMeleeThreatHarmTick = -99999;
     this.lastEngageTargetTick    = -99999;
     this.lastAttackTargetTick    = -99999;
     this.lastAttackedTarget      = LocalTargetInfo.Invalid;
     this.enemyTarget             = null;
     this.duty = null;
     this.thinkData.Clear();
     this.lastAssignedInteractTime    = -99999;
     this.lastInventoryRawFoodUseTick = 0;
     this.priorityWork.Clear();
     this.nextMoveOrderIsWait             = true;
     this.lastTakeCombatEnhancingDrugTick = -99999;
     this.lastHarmTick                  = -99999;
     this.anyCloseHostilesRecently      = false;
     this.willJoinColonyIfRescued       = false;
     this.wildManEverReachedOutside     = false;
     this.timesGuestTendedToByPlayer    = 0;
     this.lastSelfTendTick              = -99999;
     this.spawnedByInfestationThingComp = false;
 }
コード例 #10
0
 private void TryFindAndStartJob()
 {
     if (this.pawn.thinker == null)
     {
         Log.ErrorOnce(this.pawn + " did TryFindAndStartJob but had no thinker.", 8573261, false);
     }
     else
     {
         if (this.curJob != null)
         {
             Log.Warning(this.pawn + " doing TryFindAndStartJob while still having job " + this.curJob, false);
         }
         if (this.debugLog)
         {
             this.DebugLogEvent("TryFindAndStartJob");
         }
         if (!this.CanDoAnyJob())
         {
             if (this.debugLog)
             {
                 this.DebugLogEvent("   CanDoAnyJob is false. Clearing queue and returning");
             }
             this.ClearQueuedJobs();
         }
         else
         {
             ThinkTreeDef thinkTreeDef;
             ThinkResult  result = this.DetermineNextJob(out thinkTreeDef);
             if (result.IsValid)
             {
                 this.CheckLeaveJoinableLordBecauseJobIssued(result);
                 Job          job        = result.Job;
                 ThinkNode    sourceNode = result.SourceNode;
                 ThinkTreeDef thinkTree  = thinkTreeDef;
                 this.StartJob(job, JobCondition.None, sourceNode, false, false, thinkTree, result.Tag, result.FromQueue);
             }
         }
     }
 }
コード例 #11
0
ファイル: Pawn_JobTracker.cs プロジェクト: potsh/RimWorld
 private void TryFindAndStartJob()
 {
     if (pawn.thinker == null)
     {
         Log.ErrorOnce(pawn + " did TryFindAndStartJob but had no thinker.", 8573261);
     }
     else
     {
         if (curJob != null)
         {
             Log.Warning(pawn + " doing TryFindAndStartJob while still having job " + curJob);
         }
         if (debugLog)
         {
             DebugLogEvent("TryFindAndStartJob");
         }
         if (!CanDoAnyJob())
         {
             if (debugLog)
             {
                 DebugLogEvent("   CanDoAnyJob is false. Clearing queue and returning");
             }
             ClearQueuedJobs();
         }
         else
         {
             ThinkTreeDef thinkTree;
             ThinkResult  result = DetermineNextJob(out thinkTree);
             if (result.IsValid)
             {
                 CheckLeaveJoinableLordBecauseJobIssued(result);
                 Job          job        = result.Job;
                 ThinkNode    sourceNode = result.SourceNode;
                 ThinkTreeDef thinkTree2 = thinkTree;
                 StartJob(job, JobCondition.None, sourceNode, resumeCurJobAfterwards: false, cancelBusyStances: false, thinkTree2, result.Tag, result.FromQueue);
             }
         }
     }
 }
コード例 #12
0
 public void StartJob(Job newJob, JobCondition lastJobEndCondition = JobCondition.None, ThinkNode jobGiver = null, bool resumeCurJobAfterwards = false, bool cancelBusyStances = true, ThinkTreeDef thinkTree = null, JobTag?tag = null, bool fromQueue = false)
 {
     this.startingNewJob = true;
     try
     {
         if (!fromQueue && (!Find.TickManager.Paused || this.lastJobGivenAtFrame == RealTime.frameCount))
         {
             this.jobsGivenThisTick++;
             this.jobsGivenThisTickTextual = this.jobsGivenThisTickTextual + "(" + newJob.ToString() + ") ";
         }
         this.lastJobGivenAtFrame = RealTime.frameCount;
         if (this.jobsGivenThisTick > 10)
         {
             string text = this.jobsGivenThisTickTextual;
             this.jobsGivenThisTick        = 0;
             this.jobsGivenThisTickTextual = "";
             this.startingNewJob           = false;
             this.pawn.ClearReservationsForJob(newJob);
             JobUtility.TryStartErrorRecoverJob(this.pawn, string.Concat(new string[]
             {
                 this.pawn.ToStringSafe <Pawn>(),
                 " started 10 jobs in one tick. newJob=",
                 newJob.ToStringSafe <Job>(),
                 " jobGiver=",
                 jobGiver.ToStringSafe <ThinkNode>(),
                 " jobList=",
                 text
             }), null, null);
         }
         else
         {
             if (this.debugLog)
             {
                 this.DebugLogEvent(string.Concat(new object[]
                 {
                     "StartJob [",
                     newJob,
                     "] lastJobEndCondition=",
                     lastJobEndCondition,
                     ", jobGiver=",
                     jobGiver,
                     ", cancelBusyStances=",
                     cancelBusyStances
                 }));
             }
             if (cancelBusyStances && this.pawn.stances.FullBodyBusy)
             {
                 this.pawn.stances.CancelBusyStanceHard();
             }
             if (this.curJob != null)
             {
                 if (lastJobEndCondition == JobCondition.None)
                 {
                     Log.Warning(string.Concat(new object[]
                     {
                         this.pawn,
                         " starting job ",
                         newJob,
                         " from JobGiver ",
                         this.pawn.mindState.lastJobGiver,
                         " while already having job ",
                         this.curJob,
                         " without a specific job end condition."
                     }), false);
                     lastJobEndCondition = JobCondition.InterruptForced;
                 }
                 if (resumeCurJobAfterwards && this.curJob.def.suspendable)
                 {
                     this.jobQueue.EnqueueFirst(this.curJob, null);
                     if (this.debugLog)
                     {
                         this.DebugLogEvent("   JobQueue EnqueueFirst curJob: " + this.curJob);
                     }
                     this.CleanupCurrentJob(lastJobEndCondition, false, cancelBusyStances);
                 }
                 else
                 {
                     this.CleanupCurrentJob(lastJobEndCondition, true, cancelBusyStances);
                 }
             }
             if (newJob == null)
             {
                 Log.Warning(this.pawn + " tried to start doing a null job.", false);
             }
             else
             {
                 newJob.startTick = Find.TickManager.TicksGame;
                 if (this.pawn.Drafted || newJob.playerForced)
                 {
                     newJob.ignoreForbidden    = true;
                     newJob.ignoreDesignations = true;
                 }
                 this.curJob = newJob;
                 this.pawn.mindState.lastJobGiver          = jobGiver;
                 this.pawn.mindState.lastJobGiverThinkTree = thinkTree;
                 this.curDriver = this.curJob.MakeDriver(this.pawn);
                 if (this.curDriver.TryMakePreToilReservations())
                 {
                     Job job = this.TryOpportunisticJob(newJob);
                     if (job != null)
                     {
                         this.jobQueue.EnqueueFirst(newJob, null);
                         this.curJob    = null;
                         this.curDriver = null;
                         this.StartJob(job, JobCondition.None, null, false, true, null, null, false);
                     }
                     else
                     {
                         if (tag != null)
                         {
                             this.pawn.mindState.lastJobTag = tag.Value;
                         }
                         this.curDriver.SetInitialPosture();
                         this.curDriver.Notify_Starting();
                         this.curDriver.SetupToils();
                         this.curDriver.ReadyForNextToil();
                     }
                 }
                 else if (fromQueue)
                 {
                     this.EndCurrentJob(JobCondition.QueuedNoLongerValid, true);
                 }
                 else
                 {
                     Log.Warning("TryMakePreToilReservations() returned false for a non-queued job right after StartJob(). This should have been checked before. curJob=" + this.curJob.ToStringSafe <Job>(), false);
                     this.EndCurrentJob(JobCondition.Errored, true);
                 }
             }
         }
     }
     finally
     {
         this.startingNewJob = false;
     }
 }
コード例 #13
0
 public void StartJob(Job newJob, JobCondition lastJobEndCondition = JobCondition.None, ThinkNode jobGiver = null, bool resumeCurJobAfterwards = false, bool cancelBusyStances = true, ThinkTreeDef thinkTree = null, JobTag?tag = null, bool fromQueue = false, bool canReturnCurJobToPool = false)
 {
     startingNewJob = true;
     try
     {
         if (!fromQueue && (!Find.TickManager.Paused || lastJobGivenAtFrame == RealTime.frameCount))
         {
             jobsGivenThisTick++;
             if (Prefs.DevMode)
             {
                 jobsGivenThisTickTextual = jobsGivenThisTickTextual + "(" + newJob.ToString() + ") ";
             }
         }
         lastJobGivenAtFrame = RealTime.frameCount;
         if (jobsGivenThisTick > 10)
         {
             string text = jobsGivenThisTickTextual;
             jobsGivenThisTick        = 0;
             jobsGivenThisTickTextual = "";
             startingNewJob           = false;
             pawn.ClearReservationsForJob(newJob);
             JobUtility.TryStartErrorRecoverJob(pawn, pawn.ToStringSafe() + " started 10 jobs in one tick. newJob=" + newJob.ToStringSafe() + " jobGiver=" + jobGiver.ToStringSafe() + " jobList=" + text);
             return;
         }
         if (debugLog)
         {
             DebugLogEvent(string.Concat("StartJob [", newJob, "] lastJobEndCondition=", lastJobEndCondition, ", jobGiver=", jobGiver, ", cancelBusyStances=", cancelBusyStances.ToString()));
         }
         if (cancelBusyStances && pawn.stances.FullBodyBusy)
         {
             pawn.stances.CancelBusyStanceHard();
         }
         if (curJob != null)
         {
             if (lastJobEndCondition == JobCondition.None)
             {
                 Log.Warning(string.Concat(pawn, " starting job ", newJob, " from JobGiver ", newJob.jobGiver, " while already having job ", curJob, " without a specific job end condition."));
                 lastJobEndCondition = JobCondition.InterruptForced;
             }
             if (resumeCurJobAfterwards && curJob.def.suspendable)
             {
                 jobQueue.EnqueueFirst(curJob);
                 if (debugLog)
                 {
                     DebugLogEvent("   JobQueue EnqueueFirst curJob: " + curJob);
                 }
                 CleanupCurrentJob(lastJobEndCondition, releaseReservations: false, cancelBusyStances);
             }
             else
             {
                 CleanupCurrentJob(lastJobEndCondition, releaseReservations: true, cancelBusyStances, canReturnCurJobToPool);
             }
         }
         if (newJob == null)
         {
             Log.Warning(string.Concat(pawn, " tried to start doing a null job."));
             return;
         }
         newJob.startTick = Find.TickManager.TicksGame;
         if (pawn.Drafted || newJob.playerForced)
         {
             newJob.ignoreForbidden    = true;
             newJob.ignoreDesignations = true;
         }
         curJob = newJob;
         curJob.jobGiverThinkTree = thinkTree;
         curJob.jobGiver          = jobGiver;
         curDriver = curJob.MakeDriver(pawn);
         bool flag = fromQueue;
         if (curDriver.TryMakePreToilReservations(!flag))
         {
             Job job = TryOpportunisticJob(newJob);
             if (job != null)
             {
                 jobQueue.EnqueueFirst(newJob);
                 curJob    = null;
                 curDriver = null;
                 StartJob(job);
                 return;
             }
             if (tag.HasValue)
             {
                 pawn.mindState.lastJobTag = tag.Value;
             }
             curDriver.SetInitialPosture();
             curDriver.Notify_Starting();
             curDriver.SetupToils();
             curDriver.ReadyForNextToil();
         }
         else if (flag)
         {
             EndCurrentJob(JobCondition.QueuedNoLongerValid);
         }
         else
         {
             Log.Warning("TryMakePreToilReservations() returned false for a non-queued job right after StartJob(). This should have been checked before. curJob=" + curJob.ToStringSafe());
             EndCurrentJob(JobCondition.Errored);
         }
     }
     finally
     {
         startingNewJob = false;
     }
 }
コード例 #14
0
 protected override void ResolveSubnodes()
 {
     this.subtreeNode = this.treeDef.thinkRoot.DeepCopy(true);
     this.subNodes.Add(this.subtreeNode);
 }
コード例 #15
0
 public void StartJob(Job newJob, JobCondition lastJobEndCondition = JobCondition.None, ThinkNode jobGiver = null, bool resumeCurJobAfterwards = false, bool cancelBusyStances = true, ThinkTreeDef thinkTree = null, JobTag?tag = default(JobTag?), bool fromQueue = false)
 {
     this.startingNewJob = true;
     try
     {
         if (!fromQueue && (!Find.TickManager.Paused || this.lastJobGivenAtFrame == RealTime.frameCount))
         {
             this.jobsGivenThisTick++;
             this.jobsGivenThisTickTextual = this.jobsGivenThisTickTextual + "(" + newJob.ToString() + ") ";
         }
         this.lastJobGivenAtFrame = RealTime.frameCount;
         if (this.jobsGivenThisTick > 10)
         {
             string text = this.jobsGivenThisTickTextual;
             this.jobsGivenThisTick        = 0;
             this.jobsGivenThisTickTextual = string.Empty;
             this.startingNewJob           = false;
             this.pawn.ClearReservationsForJob(newJob);
             this.StartErrorRecoverJob(this.pawn + " started 10 jobs in one tick. newJob=" + newJob + " jobGiver=" + jobGiver + " jobList=" + text);
         }
         else
         {
             PawnPosture     posture    = this.pawn.GetPosture();
             LayingDownState layingDown = (this.pawn.jobs != null && this.pawn.jobs.curDriver != null) ? this.pawn.jobs.curDriver.layingDown : LayingDownState.NotLaying;
             if (this.debugLog)
             {
                 this.DebugLogEvent("StartJob [" + newJob + "] lastJobEndCondition=" + lastJobEndCondition + ", jobGiver=" + jobGiver + ", cancelBusyStances=" + cancelBusyStances);
             }
             if (cancelBusyStances && this.pawn.stances.FullBodyBusy)
             {
                 this.pawn.stances.CancelBusyStanceHard();
             }
             if (this.curJob != null)
             {
                 if (lastJobEndCondition == JobCondition.None)
                 {
                     Log.Warning(this.pawn + " starting job " + newJob + " from JobGiver " + this.pawn.mindState.lastJobGiver + " while already having job " + this.curJob + " without a specific job end condition.");
                     lastJobEndCondition = JobCondition.InterruptForced;
                 }
                 if (resumeCurJobAfterwards && this.curJob.def.suspendable)
                 {
                     this.jobQueue.EnqueueFirst(this.curJob, null);
                     if (this.debugLog)
                     {
                         this.DebugLogEvent("   JobQueue EnqueueFirst curJob: " + this.curJob);
                     }
                     this.CleanupCurrentJob(lastJobEndCondition, false, cancelBusyStances);
                 }
                 else
                 {
                     this.CleanupCurrentJob(lastJobEndCondition, true, cancelBusyStances);
                 }
             }
             if (newJob == null)
             {
                 Log.Warning(this.pawn + " tried to start doing a null job.");
             }
             else
             {
                 newJob.startTick = Find.TickManager.TicksGame;
                 if (this.pawn.Drafted || newJob.playerForced)
                 {
                     newJob.ignoreForbidden    = true;
                     newJob.ignoreDesignations = true;
                 }
                 this.curJob = newJob;
                 this.pawn.mindState.lastJobGiver          = jobGiver;
                 this.pawn.mindState.lastJobGiverThinkTree = thinkTree;
                 this.curDriver = this.curJob.MakeDriver(this.pawn);
                 if (this.curDriver.TryMakePreToilReservations())
                 {
                     if (tag.HasValue)
                     {
                         this.pawn.mindState.lastJobTag = tag.Value;
                     }
                     this.curDriver.Notify_Starting();
                     this.curDriver.Notify_LastPosture(posture, layingDown);
                     this.curDriver.SetupToils();
                     this.curDriver.ReadyForNextToil();
                 }
                 else if (fromQueue)
                 {
                     this.EndCurrentJob(JobCondition.QueuedNoLongerValid, true);
                 }
                 else
                 {
                     Log.Warning("TryMakePreToilReservations() returned false for a non-queued job right after StartJob(). This should have been checked before. curJob=" + this.curJob.ToStringSafe());
                     this.EndCurrentJob(JobCondition.Errored, true);
                 }
             }
         }
     }
     finally
     {
         this.startingNewJob = false;
     }
 }