private void JobStarted(Job job) { if (givenTask || !job.playerForced || freeJobs.Contains(job.def)) { return; } givenTask = true; startedTask = true; givenTaskTick = Find.TickManager.TicksGame; if (!playedAcceptSound) { MeeseeksUtility.PlayAcceptTaskSound(this.parent, voice); playedAcceptSound = true; } savedJob = new SavedJob(job); if (job.workGiverDef != null && job.workGiverDef.Worker != null && potentialTargetCache.ContainsKey(job.workGiverDef.Worker)) { AddJobTarget(new SavedTargetInfo(potentialTargetCache[job.workGiverDef.Worker]), true); } else { TargetIndex targetIndex = GetJobPrimaryTarget(job); if (targetIndex != TargetIndex.None) { AddJobTarget(new SavedTargetInfo(job.GetTarget(targetIndex)), true); } else { Logger.MessageFormat(this, "No target found for {0}", job.def.defName); } } potentialTargetCache.Clear(); }
public void CopyJobDataFrom(CompMeeseeksMemory otherMemory) { if (otherMemory.givenTask) { jobTargets = new List <SavedTargetInfo>(otherMemory.jobTargets); givenTask = otherMemory.givenTask; startedTask = otherMemory.startedTask; taskCompleted = otherMemory.taskCompleted; savedJob = new SavedJob(otherMemory.savedJob.MakeJob()); givenTaskTick = Find.TickManager.TicksGame; guardPosition = otherMemory.guardPosition; if (guardPosition.IsValid) { ((Pawn)parent).drafter.Drafted = true; } MeeseeksUtility.PlayAcceptTaskSound(this.parent, voice); } }