protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); this.FailOnAggroMentalStateAndHostile(TargetIndex.A); this.FailOn(delegate { if (this.$this.job.def.makeTargetPrisoner) { if (!this.$this.DropBed.ForPrisoners) { return(true); } } else if (this.$this.DropBed.ForPrisoners != this.$this.Takee.IsPrisoner) { return(true); } return(false); }); yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A)); base.AddFinishAction(delegate { if (this.$this.job.def.makeTargetPrisoner && this.$this.Takee.ownership.OwnedBed == this.$this.DropBed && this.$this.Takee.Position != RestUtility.GetBedSleepingSlotPosFor(this.$this.Takee, this.$this.DropBed)) { this.$this.Takee.ownership.UnclaimBed(); } }); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => this.$this.job.def == JobDefOf.Arrest && !this.$this.Takee.CanBeArrestedBy(this.$this.pawn)).FailOn(() => !this.$this.pawn.CanReach(this.$this.DropBed, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn)).FailOn(() => this.$this.job.def == JobDefOf.Rescue && !this.$this.Takee.Downed).FailOnSomeonePhysicallyInteracting(TargetIndex.A)); yield return(new Toil { initAction = delegate { if (this.$this.job.def.makeTargetPrisoner) { Pawn pawn = (Pawn)this.$this.job.targetA.Thing; Lord lord = pawn.GetLord(); if (lord != null) { lord.Notify_PawnAttemptArrested(pawn); } GenClamor.DoClamor(pawn, 10f, ClamorDefOf.Harm); if (this.$this.job.def == JobDefOf.Arrest && !pawn.CheckAcceptArrest(this.$this.pawn)) { this.$this.pawn.jobs.EndCurrentJob(JobCondition.Incompletable, true); } } } }); Toil startCarrying = Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false).FailOnNonMedicalBedNotOwned(TargetIndex.B, TargetIndex.A); startCarrying.AddPreInitAction(new Action(this.CheckMakeTakeeGuest)); yield return(startCarrying); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)); yield return(new Toil { initAction = delegate { this.$this.CheckMakeTakeePrisoner(); if (this.$this.Takee.playerSettings == null) { this.$this.Takee.playerSettings = new Pawn_PlayerSettings(this.$this.Takee); } } }); yield return(Toils_Reserve.Release(TargetIndex.B)); yield return(new Toil { initAction = delegate { IntVec3 position = this.$this.DropBed.Position; Thing thing; this.$this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out thing, null); if (!this.$this.DropBed.Destroyed && (this.$this.DropBed.owners.Contains(this.$this.Takee) || (this.$this.DropBed.Medical && this.$this.DropBed.AnyUnoccupiedSleepingSlot) || this.$this.Takee.ownership == null)) { this.$this.Takee.jobs.Notify_TuckedIntoBed(this.$this.DropBed); if (this.$this.Takee.RaceProps.Humanlike && this.$this.job.def != JobDefOf.Arrest && !this.$this.Takee.IsPrisonerOfColony) { this.$this.Takee.relations.Notify_RescuedBy(this.$this.pawn); } this.$this.Takee.mindState.Notify_TuckedIntoBed(); } if (this.$this.Takee.IsPrisonerOfColony) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.PrisonerTab, this.$this.Takee, OpportunityType.GoodToKnow); } }, defaultCompleteMode = ToilCompleteMode.Instant }); }
public static void TeachOpportunity(ConceptDef conc, OpportunityType opp) { LessonAutoActivator.TeachOpportunity(conc, null, opp); }
public override void Init() { base.Init(); LessonAutoActivator.TeachOpportunity(ConceptDefOf.Drafting, OpportunityType.Critical); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; this.ResolveRaidPoints(parms); if (!this.TryResolveRaidFaction(parms)) { return(false); } this.ResolveRaidStrategy(parms); this.ResolveRaidArriveMode(parms); if (!this.ResolveRaidSpawnCenter(parms)) { return(false); } IncidentParmsUtility.AdjustPointsForGroupArrivalParams(parms); PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(parms, false); List <Pawn> list = PawnGroupMakerUtility.GeneratePawns(PawnGroupKindDefOf.Normal, defaultPawnGroupMakerParms, true).ToList(); if (list.Count == 0) { Log.Error("Got no pawns spawning raid from parms " + parms); return(false); } TargetInfo target = TargetInfo.Invalid; if (parms.raidArrivalMode == PawnsArriveMode.CenterDrop || parms.raidArrivalMode == PawnsArriveMode.EdgeDrop) { DropPodUtility.DropThingsNear(parms.spawnCenter, map, list.Cast <Thing>(), parms.raidPodOpenDelay, false, true, true, false); target = new TargetInfo(parms.spawnCenter, map, false); } else { foreach (Pawn item in list) { IntVec3 loc = CellFinder.RandomClosewalkCellNear(parms.spawnCenter, map, 8, null); GenSpawn.Spawn(item, loc, map, parms.spawnRotation, false); target = item; } } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Points = " + parms.points.ToString("F0")); foreach (Pawn item2 in list) { string str = (item2.equipment == null || item2.equipment.Primary == null) ? "unarmed" : item2.equipment.Primary.LabelCap; stringBuilder.AppendLine(item2.KindLabel + " - " + str); } string letterLabel = this.GetLetterLabel(parms); string letterText = this.GetLetterText(parms, list); PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, this.GetRelatedPawnsInfoLetterText(parms), true, true); Find.LetterStack.ReceiveLetter(letterLabel, letterText, this.GetLetterDef(), target, stringBuilder.ToString()); if (this.GetLetterDef() == LetterDefOf.ThreatBig) { TaleRecorder.RecordTale(TaleDefOf.RaidArrived); } Lord lord = LordMaker.MakeNewLord(parms.faction, parms.raidStrategy.Worker.MakeLordJob(parms, map), map, list); AvoidGridMaker.RegenerateAvoidGridsFor(parms.faction, map); LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical); if (!PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.ShieldBelts)) { for (int i = 0; i < list.Count; i++) { Pawn pawn = list[i]; if (pawn.apparel.WornApparel.Any((Apparel ap) => ap is ShieldBelt)) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.ShieldBelts, OpportunityType.Critical); break; } } } if (DebugViewSettings.drawStealDebug && parms.faction.HostileTo(Faction.OfPlayer)) { Log.Message("Market value threshold to start stealing: " + StealAIUtility.StartStealingMarketValueThreshold(lord) + " (colony wealth = " + map.wealthWatcher.WealthTotal + ")"); } return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { ResolveRaidPoints(parms); if (!TryResolveRaidFaction(parms)) { return(false); } PawnGroupKindDef combat = PawnGroupKindDefOf.Combat; ResolveRaidStrategy(parms, combat); ResolveRaidArriveMode(parms); parms.raidStrategy.Worker.TryGenerateThreats(parms); if (!parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms)) { return(false); } float points = parms.points; parms.points = AdjustedRaidPoints(parms.points, parms.raidArrivalMode, parms.raidStrategy, parms.faction, combat); List <Pawn> list = parms.raidStrategy.Worker.SpawnThreats(parms); if (list == null) { list = PawnGroupMakerUtility.GeneratePawns(IncidentParmsUtility.GetDefaultPawnGroupMakerParms(combat, parms)).ToList(); if (list.Count == 0) { Log.Error("Got no pawns spawning raid from parms " + parms); return(false); } parms.raidArrivalMode.Worker.Arrive(list, parms); } GenerateRaidLoot(parms, points, list); TaggedString letterLabel = GetLetterLabel(parms); TaggedString letterText = GetLetterText(parms, list); PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, GetRelatedPawnsInfoLetterText(parms), informEvenIfSeenBefore: true); List <TargetInfo> list2 = new List <TargetInfo>(); if (parms.pawnGroups != null) { List <List <Pawn> > list3 = IncidentParmsUtility.SplitIntoGroups(list, parms.pawnGroups); List <Pawn> list4 = list3.MaxBy((List <Pawn> x) => x.Count); if (list4.Any()) { list2.Add(list4[0]); } for (int i = 0; i < list3.Count; i++) { if (list3[i] != list4 && list3[i].Any()) { list2.Add(list3[i][0]); } } } else if (list.Any()) { foreach (Pawn item in list) { list2.Add(item); } } SendStandardLetter(letterLabel, letterText, GetLetterDef(), parms, list2); parms.raidStrategy.Worker.MakeLords(parms, list); LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical); if (!PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.ShieldBelts)) { for (int j = 0; j < list.Count; j++) { if (list[j].apparel.WornApparel.Any((Apparel ap) => ap is ShieldBelt)) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.ShieldBelts, OpportunityType.Critical); break; } } } return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; this.ResolveRaidPoints(parms); if (!this.TryResolveRaidFaction(parms)) { return(false); } PawnGroupKindDef combat = PawnGroupKindDefOf.Combat; this.ResolveRaidStrategy(parms, combat); this.ResolveRaidArriveMode(parms); if (!parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms)) { return(false); } parms.points = IncidentWorker_Raid.AdjustedRaidPoints(parms.points, parms.raidArrivalMode, parms.raidStrategy, parms.faction, combat); PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(combat, parms, false); List <Pawn> list = PawnGroupMakerUtility.GeneratePawns(defaultPawnGroupMakerParms, true).ToList <Pawn>(); if (list.Count == 0) { Log.Error("Got no pawns spawning raid from parms " + parms, false); return(false); } parms.raidArrivalMode.Worker.Arrive(list, parms); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Points = " + parms.points.ToString("F0")); foreach (Pawn pawn in list) { string str = (pawn.equipment == null || pawn.equipment.Primary == null) ? "unarmed" : pawn.equipment.Primary.LabelCap; stringBuilder.AppendLine(pawn.KindLabel + " - " + str); } string letterLabel = this.GetLetterLabel(parms); string letterText = this.GetLetterText(parms, list); PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, this.GetRelatedPawnsInfoLetterText(parms), true, true); List <TargetInfo> list2 = new List <TargetInfo>(); if (parms.pawnGroups != null) { List <List <Pawn> > list3 = IncidentParmsUtility.SplitIntoGroups(list, parms.pawnGroups); List <Pawn> list4 = list3.MaxBy((List <Pawn> x) => x.Count); if (list4.Any <Pawn>()) { list2.Add(list4[0]); } for (int i = 0; i < list3.Count; i++) { if (list3[i] != list4) { if (list3[i].Any <Pawn>()) { list2.Add(list3[i][0]); } } } } else if (list.Any <Pawn>()) { list2.Add(list[0]); } Find.LetterStack.ReceiveLetter(letterLabel, letterText, this.GetLetterDef(), list2, parms.faction, stringBuilder.ToString()); parms.raidStrategy.Worker.MakeLords(parms, list); AvoidGridMaker.RegenerateAvoidGridsFor(parms.faction, map); LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical); if (!PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.ShieldBelts)) { for (int j = 0; j < list.Count; j++) { Pawn pawn2 = list[j]; if (pawn2.apparel.WornApparel.Any((Apparel ap) => ap is ShieldBelt)) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.ShieldBelts, OpportunityType.Critical); break; } } } return(true); }
protected override void FinalizeDesignationSucceeded() { base.FinalizeDesignationSucceeded(); LessonAutoActivator.TeachOpportunity(ConceptDefOf.StorageTab, OpportunityType.GoodToKnow); }
public override void PostOpen() { base.PostOpen(); Find.GameInitData.ChooseRandomStartingTile(); LessonAutoActivator.TeachOpportunity(ConceptDefOf.WorldCameraMovement, OpportunityType.Important); TutorSystem.Notify_Event("PageStart-SelectStartingSite"); tutorialStartTilePatch = null; if (!TutorSystem.TutorialMode || Find.Tutor.activeLesson == null || Find.Tutor.activeLesson.Current == null || Find.Tutor.activeLesson.Current.Instruction != InstructionDefOf.ChooseLandingSite) { return; } Find.WorldCameraDriver.ResetAltitude(); Find.WorldCameraDriver.Update(); List <int> list = new List <int>(); float[] array = new float[Find.WorldGrid.TilesCount]; WorldGrid worldGrid = Find.WorldGrid; Vector2 a = new Vector2((float)Screen.width / 2f, (float)Screen.height / 2f); float num = Vector2.Distance(a, Vector2.zero); for (int i = 0; i < worldGrid.TilesCount; i++) { Tile tile = worldGrid[i]; if (TutorSystem.AllowAction("ChooseBiome-" + tile.biome.defName + "-" + tile.hilliness.ToString())) { tmpTileVertices.Clear(); worldGrid.GetTileVertices(i, tmpTileVertices); Vector3 zero = Vector3.zero; for (int j = 0; j < tmpTileVertices.Count; j++) { zero += tmpTileVertices[j]; } zero /= (float)tmpTileVertices.Count; Vector3 v = Find.WorldCamera.WorldToScreenPoint(zero) / Prefs.UIScale; v.y = (float)UI.screenHeight - v.y; v.x = Mathf.Clamp(v.x, 0f, UI.screenWidth); v.y = Mathf.Clamp(v.y, 0f, UI.screenHeight); float num2 = 1f - Vector2.Distance(a, v) / num; Vector3 normalized = (zero - Find.WorldCamera.transform.position).normalized; float num3 = Vector3.Dot(Find.WorldCamera.transform.forward, normalized); array[i] = num2 * num3; } else { array[i] = float.NegativeInfinity; } } for (int k = 0; k < 16; k++) { for (int l = 0; l < array.Length; l++) { list.Clear(); worldGrid.GetTileNeighbors(l, list); float num4 = array[l]; if (num4 < 0f) { continue; } for (int m = 0; m < list.Count; m++) { float num5 = array[list[m]]; if (!(num5 < 0f)) { num4 += num5; } } array[l] = num4 / (float)list.Count; } } float num6 = float.NegativeInfinity; int num7 = -1; for (int n = 0; n < array.Length; n++) { if (array[n] > 0f && num6 < array[n]) { num6 = array[n]; num7 = n; } } if (num7 != -1) { tutorialStartTilePatch = num7; } }
public override void Init() { LessonAutoActivator.TeachOpportunity(ConceptDefOf.ForbiddingDoors, OpportunityType.Critical); LessonAutoActivator.TeachOpportunity(ConceptDefOf.AllowedAreas, OpportunityType.Critical); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); this.FailOnAggroMentalStateAndHostile(TargetIndex.A); this.FailOn(delegate { if (job.def.makeTargetPrisoner) { if (!DropBed.ForPrisoners) { return(true); } } else if (DropBed.ForPrisoners != Takee.IsPrisoner) { return(true); } return(false); }); yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A)); AddFinishAction(delegate { if (job.def.makeTargetPrisoner && Takee.ownership.OwnedBed == DropBed && Takee.Position != RestUtility.GetBedSleepingSlotPosFor(Takee, DropBed)) { Takee.ownership.UnclaimBed(); } }); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B) .FailOn(() => job.def == JobDefOf.Arrest && !Takee.CanBeArrestedBy(pawn)) .FailOn(() => !pawn.CanReach(DropBed, PathEndMode.OnCell, Danger.Deadly)) .FailOn(() => (job.def == JobDefOf.Rescue || job.def == JobDefOf.Capture) && !Takee.Downed) .FailOnSomeonePhysicallyInteracting(TargetIndex.A)); Toil toil = new Toil(); toil.initAction = delegate { if (job.def.makeTargetPrisoner) { Pawn pawn = (Pawn)job.targetA.Thing; pawn.GetLord()?.Notify_PawnAttemptArrested(pawn); GenClamor.DoClamor(pawn, 10f, ClamorDefOf.Harm); if (!pawn.IsPrisoner) { QuestUtility.SendQuestTargetSignals(pawn.questTags, "Arrested", pawn.Named("SUBJECT")); } if (job.def == JobDefOf.Arrest && !pawn.CheckAcceptArrest(base.pawn)) { base.pawn.jobs.EndCurrentJob(JobCondition.Incompletable); } } }; yield return(toil); Toil toil2 = Toils_Haul.StartCarryThing(TargetIndex.A).FailOnNonMedicalBedNotOwned(TargetIndex.B, TargetIndex.A); toil2.AddPreInitAction(CheckMakeTakeeGuest); yield return(toil2); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)); Toil toil3 = new Toil(); toil3.initAction = delegate { CheckMakeTakeePrisoner(); if (Takee.playerSettings == null) { Takee.playerSettings = new Pawn_PlayerSettings(Takee); } }; yield return(toil3); yield return(Toils_Reserve.Release(TargetIndex.B)); Toil toil4 = new Toil(); toil4.initAction = delegate { IntVec3 position = DropBed.Position; pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out var _); if (!DropBed.Destroyed && (DropBed.OwnersForReading.Contains(Takee) || (DropBed.Medical && DropBed.AnyUnoccupiedSleepingSlot) || Takee.ownership == null)) { Takee.jobs.Notify_TuckedIntoBed(DropBed); if (Takee.RaceProps.Humanlike && job.def != JobDefOf.Arrest && !Takee.IsPrisonerOfColony) { Takee.relations.Notify_RescuedBy(pawn); } Takee.mindState.Notify_TuckedIntoBed(); } if (Takee.IsPrisonerOfColony) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.PrisonerTab, Takee, OpportunityType.GoodToKnow); } }; toil4.defaultCompleteMode = ToilCompleteMode.Instant; yield return(toil4); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: draft = new Command_Toggle(); draft.hotKey = KeyBindingDefOf.Command_ColonistDraft; draft.isActive = new Func <bool>(base.get_Drafted); draft.toggleAction = delegate() { base.Drafted = !base.Drafted; PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Drafting, KnowledgeAmount.SpecificInteraction); if (base.Drafted) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.QueueOrders, OpportunityType.GoodToKnow); } }; draft.defaultDesc = "CommandToggleDraftDesc".Translate(); draft.icon = TexCommand.Draft; draft.turnOnSound = SoundDefOf.DraftOn; draft.turnOffSound = SoundDefOf.DraftOff; if (!base.Drafted) { draft.defaultLabel = "CommandDraftLabel".Translate(); } if (this.pawn.Downed) { draft.Disable("IsIncapped".Translate(new object[] { this.pawn.LabelShort })); } if (!base.Drafted) { draft.tutorTag = "Draft"; } else { draft.tutorTag = "Undraft"; } this.$current = draft; if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: if (base.Drafted && this.pawn.equipment.Primary != null && this.pawn.equipment.Primary.def.IsRangedWeapon) { Command_Toggle toggleFireAtWill = new Command_Toggle(); toggleFireAtWill.hotKey = KeyBindingDefOf.Misc6; toggleFireAtWill.isActive = new Func <bool>(base.get_FireAtWill); toggleFireAtWill.toggleAction = delegate() { base.FireAtWill = !base.FireAtWill; }; toggleFireAtWill.icon = TexCommand.FireAtWill; toggleFireAtWill.defaultLabel = "CommandFireAtWillLabel".Translate(); toggleFireAtWill.defaultDesc = "CommandFireAtWillDesc".Translate(); toggleFireAtWill.tutorTag = "FireAtWillToggle"; this.$current = toggleFireAtWill; if (!this.$disposing) { this.$PC = 2; } return(true); } break; case 2u: break; default: return(false); } this.$PC = -1; return(false); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); this.FailOnAggroMentalStateAndHostile(TargetIndex.A); this.FailOn(delegate() { if (this.job.def.makeTargetPrisoner) { if (!base.DropBed.ForPrisoners) { return(true); } } else if (base.DropBed.ForPrisoners != base.Takee.IsPrisoner) { return(true); } return(false); }); this.$current = Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A); if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: base.AddFinishAction(delegate { if (this.job.def.makeTargetPrisoner && base.Takee.ownership.OwnedBed == base.DropBed && base.Takee.Position != RestUtility.GetBedSleepingSlotPosFor(base.Takee, base.DropBed)) { base.Takee.ownership.UnclaimBed(); } }); this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => this.job.def == JobDefOf.Arrest && !base.Takee.CanBeArrestedBy(this.pawn)).FailOn(() => !this.pawn.CanReach(base.DropBed, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn)).FailOn(() => this.job.def == JobDefOf.Rescue && !base.Takee.Downed).FailOnSomeonePhysicallyInteracting(TargetIndex.A); if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: { Toil checkArrestResistance = new Toil(); checkArrestResistance.initAction = delegate() { if (this.job.def.makeTargetPrisoner) { Pawn pawn = (Pawn)this.job.targetA.Thing; Lord lord = pawn.GetLord(); if (lord != null) { lord.Notify_PawnAttemptArrested(pawn); } GenClamor.DoClamor(pawn, 10f, ClamorDefOf.Harm); if (this.job.def == JobDefOf.Arrest && !pawn.CheckAcceptArrest(this.pawn)) { this.pawn.jobs.EndCurrentJob(JobCondition.Incompletable, true); } } }; this.$current = checkArrestResistance; if (!this.$disposing) { this.$PC = 3; } return(true); } case 3u: startCarrying = Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false).FailOnNonMedicalBedNotOwned(TargetIndex.B, TargetIndex.A); startCarrying.AddPreInitAction(new Action(base.CheckMakeTakeeGuest)); this.$current = startCarrying; if (!this.$disposing) { this.$PC = 4; } return(true); case 4u: this.$current = Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch); if (!this.$disposing) { this.$PC = 5; } return(true); case 5u: { Toil makePrisonerAndInit = new Toil(); makePrisonerAndInit.initAction = delegate() { base.CheckMakeTakeePrisoner(); if (base.Takee.playerSettings == null) { base.Takee.playerSettings = new Pawn_PlayerSettings(base.Takee); } }; this.$current = makePrisonerAndInit; if (!this.$disposing) { this.$PC = 6; } return(true); } case 6u: this.$current = Toils_Reserve.Release(TargetIndex.B); if (!this.$disposing) { this.$PC = 7; } return(true); case 7u: { Toil tuckIntoBed = new Toil(); tuckIntoBed.initAction = delegate() { IntVec3 position = base.DropBed.Position; Thing thing; this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out thing, null); if (!base.DropBed.Destroyed && (base.DropBed.owners.Contains(base.Takee) || (base.DropBed.Medical && base.DropBed.AnyUnoccupiedSleepingSlot) || base.Takee.ownership == null)) { base.Takee.jobs.Notify_TuckedIntoBed(base.DropBed); if (base.Takee.RaceProps.Humanlike && this.job.def != JobDefOf.Arrest && !base.Takee.IsPrisonerOfColony) { base.Takee.relations.Notify_RescuedBy(this.pawn); } base.Takee.mindState.Notify_TuckedIntoBed(); } if (base.Takee.IsPrisonerOfColony) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.PrisonerTab, base.Takee, OpportunityType.GoodToKnow); } }; tuckIntoBed.defaultCompleteMode = ToilCompleteMode.Instant; this.$current = tuckIntoBed; if (!this.$disposing) { this.$PC = 8; } return(true); } case 8u: this.$PC = -1; break; } return(false); }