public void SetGuestStatus(Faction newHost, bool prisoner = false) { if (newHost != null) { this.Released = false; } if (newHost == this.HostFaction && prisoner == this.IsPrisoner) { return; } if (!prisoner && this.pawn.Faction.HostileTo(newHost)) { Log.Error(string.Concat(new object[] { "Tried to make ", this.pawn, " a guest of ", newHost, " but their faction ", this.pawn.Faction, " is hostile to ", newHost }), false); return; } if (newHost != null && newHost == this.pawn.Faction && !prisoner) { Log.Error(string.Concat(new object[] { "Tried to make ", this.pawn, " a guest of their own faction ", this.pawn.Faction }), false); return; } bool flag = prisoner && (!this.IsPrisoner || this.HostFaction != newHost); this.isPrisonerInt = prisoner; this.hostFactionInt = newHost; this.pawn.ClearMind(false, false); if (flag) { this.pawn.DropAndForbidEverything(false); Lord lord = this.pawn.GetLord(); if (lord != null) { lord.Notify_PawnLost(this.pawn, PawnLostCondition.MadePrisoner, null); } if (newHost == Faction.OfPlayer) { Find.StoryWatcher.watcherPopAdaptation.Notify_PawnEvent(this.pawn, PopAdaptationEvent.GainedPrisoner); } if (this.pawn.Drafted) { this.pawn.drafter.Drafted = false; } float x = this.pawn.RecruitDifficulty(Faction.OfPlayer); this.resistance = Pawn_GuestTracker.StartingResistancePerRecruitDifficultyCurve.Evaluate(x); this.resistance *= Pawn_GuestTracker.StartingResistanceFactorFromPopulationIntentCurve.Evaluate(StorytellerUtilityPopulation.PopulationIntent); this.resistance *= Pawn_GuestTracker.StartingResistanceRandomFactorRange.RandomInRange; this.resistance = (float)GenMath.RoundRandom(this.resistance); } PawnComponentsUtility.AddAndRemoveDynamicComponents(this.pawn, false); this.pawn.health.surgeryBills.Clear(); if (this.pawn.ownership != null) { this.pawn.ownership.Notify_ChangedGuestStatus(); } ReachabilityUtility.ClearCacheFor(this.pawn); if (this.pawn.Spawned) { this.pawn.Map.mapPawns.UpdateRegistryForPawn(this.pawn); this.pawn.Map.attackTargetsCache.UpdateTarget(this.pawn); } AddictionUtility.CheckDrugAddictionTeachOpportunity(this.pawn); if (prisoner && this.pawn.playerSettings != null) { this.pawn.playerSettings.Notify_MadePrisoner(); } }