public static void UpdateFlickDesignation(Thing t) { bool flag = false; ThingWithComps thingWithComps = t as ThingWithComps; if (thingWithComps != null) { for (int i = 0; i < thingWithComps.AllComps.Count; i++) { CompFlickable compFlickable = thingWithComps.AllComps[i] as CompFlickable; if (compFlickable != null && compFlickable.WantsFlick()) { flag = true; break; } } } Designation designation = t.Map.designationManager.DesignationOn(t, DesignationDefOf.Flick); if (flag && designation == null) { t.Map.designationManager.AddDesignation(new Designation(t, DesignationDefOf.Flick)); } else if (!flag && designation != null) { designation.Delete(); } TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.SwitchFlickingDesignation); }
static void Postfix(JobDriver_StripA __instance, ref IEnumerable <Toil> __result) { Toil t = new Toil { initAction = delegate() { Thing thing = __instance.job.targetA.Thing; IStrippable strippable = thing as IStrippable; if (strippable != null) { strippable.Strip(); } Designation designation = __instance.MapA.designationManager.DesignationOn(thing, DesignationDefOf.Strip); if (designation != null) { designation.Delete(); } __instance.pawn.records.Increment(RecordDefOf.BodiesStripped); }, defaultCompleteMode = ToilCompleteMode.Instant }; //naive patch __result = __result.Select((x, i) => i == 2 ? t : x); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(new Toil { initAction = delegate() { if (!this.Openable.CanOpen) { Designation designation = base.Map.designationManager.DesignationOn(this.job.targetA.Thing, DesignationDefOf.Open); if (designation != null) { designation.Delete(); } } } }.FailOnDespawnedOrNull(TargetIndex.A)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnThingMissingDesignation(TargetIndex.A, DesignationDefOf.Open).FailOnDespawnedOrNull(TargetIndex.A)); yield return(Toils_General.Wait(300, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f).FailOnDespawnedOrNull(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell)); yield return(Toils_General.Open(TargetIndex.A)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOn(delegate { Designation designation = Map.designationManager.DesignationOn(TargetThingA, LockUtility.DesDef); return(designation == null); }); yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); yield return(Toils_General.Wait(15).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch)); Toil toil = new Toil(); toil.initAction = delegate { Pawn actor = toil.actor; ThingWithComps door = (ThingWithComps)actor.CurJob.targetA.Thing; this.FailOn(() => !LockUtility.GetData(door).CanChangeLocks(actor)); LockUtility.GetData(door).CurrentState.CopyFrom(LockUtility.GetData(door).WantedState); SoundDefOf.FlickSwitch.PlayOneShot(new TargetInfo(door.Position, door.Map, false)); door.Map.reachability.ClearCache(); //actor.records.Increment(RecordDefOf.SwitchesFlicked); Designation designation = Map.designationManager.DesignationOn(door, LockUtility.DesDef); if (designation != null) { designation.Delete(); } }; toil.defaultCompleteMode = ToilCompleteMode.Instant; yield return(toil); }
public static void UpdateExtinguishDesignation(Thing t) { bool flag = false; if (t is ThingWithComps thingWithComps) { for (int i = 0; i < thingWithComps.AllComps.Count; i++) { if (thingWithComps.AllComps[i] is CompExtinguishable compExtinguishable && compExtinguishable.WantsFlick()) { Tools.Warn("wants to be extinguished", true); flag = true; break; } } } Designation designation = t.Map.designationManager.DesignationOn(t, DesignationDefOf.Flick); if (flag && designation == null) { t.Map.designationManager.AddDesignation(new Designation(t, DesignationDefOf.Flick)); } else if (!flag && designation != null) { designation.Delete(); } TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.SwitchFlickingDesignation); }
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 void incrementSeen(Faction faction, int[] factionShownCells, int idx) { if ((++factionShownCells[idx] == 1) && faction.IsPlayer) { IntVec3 cell = idxToCellCache[idx]; knownCells[idx] = true; Designation designation = designationManager.DesignationAt(cell, DesignationDefOf.Mine); if (designation != null && cell.GetFirstMineable(map) == null) { designation.Delete(); } if (initialized) { mapDrawer.MapMeshDirty(cell, SectionLayer_FoVLayer.mapMeshFlag, true, false); } List <CompHideFromPlayer> comps = compHideFromPlayerGrid[idx]; int compCount = comps.Count; for (int i = 0; i < compCount; i++) { comps[i].updateVisibility(true); } } }
public void revealCell(int idx) { if (!knownCells[idx]) { ref IntVec3 cell = ref idxToCellCache[idx]; knownCells[idx] = true; Designation designation = mineDesignationGrid[idx]; if (designation != null && cell.GetFirstMineable(map) == null) { designation.Delete(); } if (initialized) { setMapMeshDirtyFlag(idx); } if (compHideFromPlayerGridCount[idx] != 0) { List <CompHideFromPlayer> comps = compHideFromPlayerGrid[idx]; int compCount = comps.Count; for (int i = 0; i < compCount; i++) { comps[i].updateVisibility(true); } } }
protected override IEnumerable<Toil> MakeNewToils() { this.FailOnDespawnedOrNull(TargetIndex.A); this.FailOnAggroMentalState(TargetIndex.A); this.FailOn(() => !StrippableUtility.CanBeStrippedByColony(this.$this.TargetThingA)); Toil gotoThing = new Toil(); gotoThing.initAction = delegate { this.$this.pawn.pather.StartPath(this.$this.TargetThingA, PathEndMode.ClosestTouch); }; gotoThing.defaultCompleteMode = ToilCompleteMode.PatherArrival; gotoThing.FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return gotoThing; yield return Toils_General.Wait(60, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); yield return new Toil { initAction = delegate { Thing thing = this.$this.job.targetA.Thing; Designation designation = this.$this.Map.designationManager.DesignationOn(thing, DesignationDefOf.Strip); if (designation != null) { designation.Delete(); } IStrippable strippable = thing as IStrippable; if (strippable != null) { strippable.Strip(); } this.$this.pawn.records.Increment(RecordDefOf.BodiesStripped); }, defaultCompleteMode = ToilCompleteMode.Instant }; }
// Token: 0x06000002 RID: 2 RVA: 0x00002072 File Offset: 0x00000272 protected override IEnumerable <Toil> MakeNewToils() { ToilFailConditions.FailOnDespawnedOrNull <JobDriver_RearmTrap>(this, TargetIndex.A); ToilFailConditions.FailOnThingMissingDesignation <JobDriver_RearmTrap>(this, TargetIndex.A, YautjaDefOf.RRY_RearmTrap); Toil toil = new Toil(); toil.initAction = delegate() { this.pawn.pather.StartPath(base.TargetThingA, PathEndMode.Touch); }; toil.defaultCompleteMode = ToilCompleteMode.PatherArrival; ToilFailConditions.FailOnDespawnedNullOrForbidden <Toil>(toil, TargetIndex.A); yield return(toil); yield return(ToilEffects.WithProgressBarToilDelay(Toils_General.Wait(1125, 0), TargetIndex.A, false, -0.5f)); yield return(new Toil { initAction = delegate() { Thing thing = this.job.targetA.Thing; Designation designation = base.Map.designationManager.DesignationOn(thing, YautjaDefOf.RRY_RearmTrap); if (designation != null) { designation.Delete(); } (thing as Building_TrapRearmable).Rearm(); this.pawn.records.Increment(YautjaDefOf.RRY_TrapsRearmed); }, defaultCompleteMode = ToilCompleteMode.Instant }); yield break; }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { Command_Toggle com = new Command_Toggle(); com.hotKey = KeyBindingDefOf.Misc5; com.defaultLabel = "Reconfigure"; com.icon = TexCommand.ToggleVent; com.isActive = new Func <bool>(delegate { return(NeedToReconfigure); }); com.toggleAction = delegate { NeedToReconfigure = !NeedToReconfigure; Designation des = parent.Map.designationManager.DesignationOn(parent, DesignationDefOf_Reconfigure.Reconfigure); if (NeedToReconfigure && des == null) { parent.Map.designationManager.AddDesignation(new Designation(parent, DesignationDefOf_Reconfigure.Reconfigure)); } else if (!NeedToReconfigure && des != null) { des.Delete(); } }; if (NeedToReconfigure) { com.defaultDesc = "This building will be reconfigured by a researcher."; } else { com.defaultDesc = "This building will maintain its current function."; } yield return(com); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: { Toil checkOpenable = new Toil(); checkOpenable.initAction = delegate() { if (!base.Openable.CanOpen) { Designation designation = base.Map.designationManager.DesignationOn(this.job.targetA.Thing, DesignationDefOf.Open); if (designation != null) { designation.Delete(); } } }; this.$current = checkOpenable.FailOnDespawnedOrNull(TargetIndex.A); if (!this.$disposing) { this.$PC = 1; } return(true); } case 1u: this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnThingMissingDesignation(TargetIndex.A, DesignationDefOf.Open).FailOnDespawnedOrNull(TargetIndex.A); if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: this.$current = Toils_General.Wait(300, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f).FailOnDespawnedOrNull(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell); if (!this.$disposing) { this.$PC = 3; } return(true); case 3u: this.$current = Toils_General.Open(TargetIndex.A); if (!this.$disposing) { this.$PC = 4; } return(true); case 4u: this.$PC = -1; break; } return(false); }
public HttpResponseMessage Delete([FromUri] int id, [FromBody] int modifiedBy) { Designation des = new Designation(); des.ID = id; des.ModifiedBy = modifiedBy; return(Request.CreateResponse(HttpStatusCode.OK, des.Delete())); }
public static void RemoveAllPlanDesignationAt(IntVec3 c, Map map) { foreach (DesignationDef def in MorePlanningMod.PlanDesDefs) { Designation desAt = map.designationManager.DesignationAt(c, def); desAt?.Delete(); } }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.FailOnDespawnedOrNull(TargetIndex.A); this.FailOn(delegate() { Designation designation = this.Map.designationManager.DesignationOn(this.TargetThingA, DesignationDefOf.Flick); return(designation == null); }); this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: this.$current = Toils_General.Wait(15, TargetIndex.None).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: < MakeNewToils > c__AnonStorey.finalize = new Toil(); < MakeNewToils > c__AnonStorey.finalize.initAction = delegate() { Pawn actor = < MakeNewToils > c__AnonStorey.finalize.actor; ThingWithComps thingWithComps = (ThingWithComps)actor.CurJob.targetA.Thing; for (int i = 0; i < thingWithComps.AllComps.Count; i++) { CompFlickable compFlickable = thingWithComps.AllComps[i] as CompFlickable; if (compFlickable != null && compFlickable.WantsFlick()) { compFlickable.DoFlick(); } } actor.records.Increment(RecordDefOf.SwitchesFlicked); Designation designation = < MakeNewToils > c__AnonStorey.< > f__ref$0.$this.Map.designationManager.DesignationOn(thingWithComps, DesignationDefOf.Flick); if (designation != null) { designation.Delete(); } };
public void GetStateGizmo(ref Command_Action command) { switch (wantedState) { case State.Open: command.icon = GraphicCache.AjarIcon; command.defaultLabel = "openwindow".TranslateSimple(); break; case State.Ajar: command.icon = GraphicCache.ClosedIcon; command.defaultLabel = "closewindow".TranslateSimple(); break; case State.Closed: command.icon = GraphicCache.OpenIcon; command.defaultLabel = "shutwindow".TranslateSimple(); break; } command.defaultDesc = "changestatewindow".TranslateSimple(); command.action = delegate { wantedState = NextState(wantedState); if (ElifsDecorationsSettings.Flickable) { if (state != wantedState) { Designation designation = Parent.Map.designationManager.DesignationOn(Parent, Window_DefOf.SwitchWindow); if (designation == null) { Parent.Map.designationManager.AddDesignation(new Designation(Parent, Window_DefOf.SwitchWindow)); } } else { Designation designation = Parent.Map.designationManager.DesignationOn(Parent, Window_DefOf.SwitchWindow); if (designation != null) { designation.Delete(); } } } else { ChangeState(); } }; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOn(() => !this.job.ignoreDesignations && this.Map.designationManager.DesignationAt(this.TargetLocA, this.DesDef) == null); yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch)); Toil doWork = new Toil(); doWork.initAction = delegate() { this.workLeft = (float)this.BaseWorkAmount; }; doWork.tickAction = delegate() { float num = (this.SpeedStat == null) ? 1f : doWork.actor.GetStatValue(this.SpeedStat, true); this.workLeft -= num; if (doWork.actor.skills != null) { doWork.actor.skills.Learn(SkillDefOf.Construction, 0.1f, false); } if (this.clearSnow) { this.Map.snowGrid.SetDepth(this.TargetLocA, 0f); } if (this.workLeft <= 0f) { this.DoEffect(this.TargetLocA); Designation designation = this.Map.designationManager.DesignationAt(this.TargetLocA, this.DesDef); if (designation != null) { designation.Delete(); } this.ReadyForNextToil(); return; } }; doWork.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); doWork.WithProgressBar(TargetIndex.A, () => 1f - this.workLeft / (float)this.BaseWorkAmount, false, -0.5f); doWork.defaultCompleteMode = ToilCompleteMode.Never; doWork.activeSkill = (() => SkillDefOf.Construction); yield return(doWork); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { yield return(new Toil { initAction = delegate { if (!((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_003e: stateMachine*/)._0024this.Openable.CanOpen) { Designation designation = ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_003e: stateMachine*/)._0024this.Map.designationManager.DesignationOn(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_003e: stateMachine*/)._0024this.job.targetA.Thing, DesignationDefOf.Open); if (designation != null) { designation.Delete(); } } } }.FailOnDespawnedOrNull(TargetIndex.A)); /*Error: Unable to find new state assignment for yield return*/; }
public static void UpdateLockDesignation(Thing t) { bool flag = false; Building_Door door = t as Building_Door; if (door != null) { flag = GetData(door).NeedChange; } Designation designation = t.Map.designationManager.DesignationOn(t, DesDef); if (flag && designation == null) { t.Map.designationManager.AddDesignation(new Designation(t, DesDef)); } else if (!flag && designation != null) { designation.Delete(); } }
public static void UpdateLockDesignation(Thing t) { bool flag = false; ThingWithComps door = t as ThingWithComps; if (door.TryGetComp <CompLock>() != null) { flag = GetData(door).NeedChange; } Designation designation = t.Map.designationManager.DesignationOn(t, DesDef); if (flag && designation == null) { t.Map.designationManager.AddDesignation(new Designation(t, DesDef)); door.Map.reachability.ClearCache(); } else if (!flag && designation != null) { designation.Delete(); } }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOn(() => !job.ignoreDesignations && Map.designationManager.DesignationAt(TargetLocA, DesDef) == null); this.FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch)); var doWork = new Toil { initAction = delegate { workLeft = (float)BaseWorkAmount; } }; doWork.tickAction = delegate { var num = (SpeedStat == null) ? 1f : doWork.actor.GetStatValue(SpeedStat, true); workLeft -= num; if (doWork.actor.skills != null) { doWork.actor.skills.Learn(SkillDefOf.Artistic, 0.1f, false); } if (workLeft <= 0f) { DoEffect(); Designation designation = Map.designationManager.DesignationAt(TargetLocA, DesDef); if (designation != null) { designation.Delete(); } ReadyForNextToil(); return; } }; doWork.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); doWork.WithProgressBar(TargetIndex.A, () => 1f - (workLeft / (float)BaseWorkAmount), false, -0.5f); doWork.defaultCompleteMode = ToilCompleteMode.Never; doWork.activeSkill = () => SkillDefOf.Artistic; yield return(doWork); }
protected override IEnumerable <Toil> MakeNewToils() { //this.FailOnDespawnedOrNull(TargetIndex.A); this.FailOn(delegate { Designation designation = this.Map.designationManager.DesignationOn(this.TargetThingA, DesignationDefOf_Reconfigure.Reconfigure); return(designation == null); }); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell)); yield return(Toils_General.Wait(100, TargetIndex.None).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch)); Toil finalize = new Toil(); finalize.initAction = delegate { Pawn actor = finalize.actor; ThingWithComps thing = (ThingWithComps)actor.CurJob.targetA.Thing; CompReconfigurable comp = thing.TryGetComp <CompReconfigurable>(); if (comp != null && comp.NeedToReconfigure) { //replace here ThingWithComps replacement = (ThingWithComps)ThingMaker.MakeThing(comp.Props.resultDef, thing.Stuff); replacement.SetFactionDirect(thing.Faction); var spawned = GenSpawn.Spawn(replacement, thing.Position, thing.Map, thing.Rotation); spawned.HitPoints = thing.HitPoints; Find.Selector.Select(spawned, false); } Designation designation = this.Map.designationManager.DesignationOn(thing, DesignationDefOf_Reconfigure.Reconfigure); if (designation != null) { designation.Delete(); } }; finalize.defaultCompleteMode = ToilCompleteMode.Instant; yield return(finalize); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedOrNull(TargetIndex.A); this.FailOn(delegate() { Designation designation = this.Map.designationManager.DesignationOn(this.TargetThingA, DesignationDefOf.Flick); return(designation == null); }); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); yield return(Toils_General.Wait(15, TargetIndex.None).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch)); Toil finalize = new Toil(); finalize.initAction = delegate() { Pawn actor = finalize.actor; ThingWithComps thingWithComps = (ThingWithComps)actor.CurJob.targetA.Thing; for (int i = 0; i < thingWithComps.AllComps.Count; i++) { CompFlickable compFlickable = thingWithComps.AllComps[i] as CompFlickable; if (compFlickable != null && compFlickable.WantsFlick()) { compFlickable.DoFlick(); } } actor.records.Increment(RecordDefOf.SwitchesFlicked); Designation designation = this.Map.designationManager.DesignationOn(thingWithComps, DesignationDefOf.Flick); if (designation != null) { designation.Delete(); } }; finalize.defaultCompleteMode = ToilCompleteMode.Instant; yield return(finalize); yield break; }
public override void Tick() { base.Tick(); // Remove potential open designation. Designation designation = Find.DesignationManager.DesignationOn(this, DesignationDefOf.Open); if (designation != null) { designation.Delete(); } Thing thing = this.ContainedThing; if (thing != null) { Pawn pawn = thing as Pawn; if (pawn != null) { SoundDef.Named("CryptosleepCasketEject").PlayOneShot(base.Position); } this.container.ClearAndDestroyContents(); } }
public static Toil Open(TargetIndex openableInd) { Toil open = new Toil(); open.initAction = delegate { Pawn actor = open.actor; Thing thing = actor.CurJob.GetTarget(openableInd).Thing; Designation designation = actor.Map.designationManager.DesignationOn(thing, DesignationDefOf.Open); if (designation != null) { designation.Delete(); } IOpenable openable = (IOpenable)thing; if (openable.CanOpen) { openable.Open(); actor.records.Increment(RecordDefOf.ContainersOpened); } }; open.defaultCompleteMode = ToilCompleteMode.Instant; return(open); }
public static Toil StripCorpse(TargetIndex corpseIndex) { Toil toil = new Toil(); toil.initAction = delegate { Pawn actor = toil.actor; Job curJob = actor.jobs.curJob; Thing thing = curJob.GetTarget(corpseIndex).Thing; Designation designation = actor.Map.designationManager.DesignationOn(thing, DesignationDefOf.Strip); if (designation != null) { designation.Delete(); } if (thing is IStrippable strippable) { strippable.Strip(); } actor.records.Increment(RecordDefOf.BodiesStripped); }; return(toil); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.FailOnDespawnedOrNull(TargetIndex.A); this.FailOnThingMissingDesignation(TargetIndex.A, DesignationDefOf.RearmTrap); gotoThing = new Toil(); gotoThing.initAction = delegate() { this.pawn.pather.StartPath(base.TargetThingA, PathEndMode.Touch); }; gotoThing.defaultCompleteMode = ToilCompleteMode.PatherArrival; gotoThing.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.$current = gotoThing; if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: this.$current = Toils_General.Wait(800, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: { Toil finalize = new Toil(); finalize.initAction = delegate() { Thing thing = this.job.targetA.Thing; Designation designation = base.Map.designationManager.DesignationOn(thing, DesignationDefOf.RearmTrap); if (designation != null) { designation.Delete(); } Building_TrapRearmable building_TrapRearmable = thing as Building_TrapRearmable; building_TrapRearmable.Rearm(); this.pawn.records.Increment(RecordDefOf.TrapsRearmed); }; finalize.defaultCompleteMode = ToilCompleteMode.Instant; this.$current = finalize; if (!this.$disposing) { this.$PC = 3; } return(true); } case 3u: this.$PC = -1; break; } return(false); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.FailOnDespawnedOrNull(TargetIndex.A); this.FailOnAggroMentalState(TargetIndex.A); this.FailOn(() => !StrippableUtility.CanBeStrippedByColony(base.TargetThingA)); gotoThing = new Toil(); gotoThing.initAction = delegate() { this.pawn.pather.StartPath(base.TargetThingA, PathEndMode.ClosestTouch); }; gotoThing.defaultCompleteMode = ToilCompleteMode.PatherArrival; gotoThing.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.$current = gotoThing; if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: this.$current = Toils_General.Wait(60, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: { Toil strip = new Toil(); strip.initAction = delegate() { Thing thing = this.job.targetA.Thing; Designation designation = base.Map.designationManager.DesignationOn(thing, DesignationDefOf.Strip); if (designation != null) { designation.Delete(); } IStrippable strippable = thing as IStrippable; if (strippable != null) { strippable.Strip(); } this.pawn.records.Increment(RecordDefOf.BodiesStripped); }; strip.defaultCompleteMode = ToilCompleteMode.Instant; this.$current = strip; if (!this.$disposing) { this.$PC = 3; } return(true); } case 3u: this.$PC = -1; break; } return(false); }