コード例 #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            CompScanner scannerComp = job.targetA.Thing.TryGetComp <CompScanner>();

            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnBurningImmobile(TargetIndex.A);
            this.FailOn(() => !scannerComp.CanUseNow);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            Toil work = new Toil();

            work.tickAction = delegate
            {
                Pawn actor = work.actor;
                _ = (Building)actor.CurJob.targetA.Thing;
                scannerComp.Used(actor);
                actor.skills.Learn(SkillDefOf.Intellectual, 0.035f);
                actor.GainComfortFromCellIfPossible(chairsOnly: true);
            };
            work.PlaySustainerOrSound(scannerComp.Props.soundWorking);
            work.AddFailCondition(() => !scannerComp.CanUseNow);
            work.defaultCompleteMode = ToilCompleteMode.Never;
            work.FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell);
            work.activeSkill = () => SkillDefOf.Intellectual;
            yield return(work);
        }
コード例 #2
0
        public override bool ShouldSkip(Pawn pawn, bool forced = false)
        {
            List <Thing> list = pawn.Map.listerThings.ThingsOfDef(ScannerDef);

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Faction == pawn.Faction)
                {
                    CompScanner compScanner = list[i].TryGetComp <CompScanner>();
                    if (compScanner != null && compScanner.CanUseNow)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }