protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedOrNull(TargetIndex.A); this.FailOnThingMissingDesignation(TargetIndex.A, BetaTrapDefOf.RearmTrap); Toil gotoThing = new Toil(); gotoThing.initAction = delegate() { this.pawn.pather.StartPath(base.TargetThingA, PathEndMode.Touch); }; gotoThing.defaultCompleteMode = ToilCompleteMode.PatherArrival; gotoThing.FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(gotoThing); yield return(Toils_General.Wait(RearmTicks).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f)); yield return(new Toil { initAction = delegate() { Thing thing = this.job.targetA.Thing; Designation designation = base.Map.designationManager.DesignationOn(thing, BetaTrapDefOf.RearmTrap); if (designation != null) { designation.Delete(); } Building_TrapRearmable building_TrapRearmable = thing as Building_TrapRearmable; building_TrapRearmable.Rearm(); this.pawn.records.Increment(BetaTrapDefOf.TrapsRearmed); }, defaultCompleteMode = ToilCompleteMode.Instant }); yield break; }
public override AcceptanceReport CanDesignateThing(Thing t) { Building_TrapRearmable building_TrapRearmable = t as Building_TrapRearmable; return(building_TrapRearmable != null && !building_TrapRearmable.Armed && base.Map.designationManager.DesignationOn(building_TrapRearmable, BetaTrapDefOf.RearmTrap) == null); }