public static float CalculateBaseTendQuality(Pawn doctor, Pawn patient, float medicinePotency, float medicineQualityMax) { float num; if (doctor != null) { num = doctor.GetStatValue(StatDefOf.MedicalTendQuality, true); } else { num = 0.75f; } num *= medicinePotency; Building_Bed building_Bed = (patient == null) ? null : patient.CurrentBed(); if (building_Bed != null) { num += building_Bed.GetStatValue(StatDefOf.MedicalTendQualityOffset, true); } if (doctor == patient && doctor != null) { num *= 0.7f; } return(Mathf.Clamp(num, 0f, medicineQualityMax)); }
public static Pawn GetPartnerInMyBed(Pawn pawn) { Building_Bed building_Bed = pawn.CurrentBed(); if (building_Bed == null) { return(null); } if (building_Bed.SleepingSlotsCount <= 1) { return(null); } if (!LovePartnerRelationUtility.HasAnyLovePartner(pawn)) { return(null); } foreach (Pawn current in building_Bed.CurOccupants) { if (current != pawn) { if (LovePartnerRelationUtility.LovePartnerRelationExists(pawn, current)) { return(current); } } } return(null); }
public static Pawn GetPartnerInMyBed(Pawn pawn) { if (pawn.CurJob == null || pawn.jobs.curDriver.layingDown == LayingDownState.NotLaying) { return null; } Building_Bed building_Bed = pawn.CurrentBed(); if (building_Bed == null) { return null; } if (building_Bed.SleepingSlotsCount <= 1) { return null; } if (!LovePartnerRelationUtility.HasAnyLovePartner(pawn)) { return null; } foreach (Pawn current in building_Bed.CurOccupants) { if (current != pawn) { if (LovePartnerRelationUtility.LovePartnerRelationExists(pawn, current)) { return current; } } } return null; }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { Pawn pawn2 = t as Pawn; if (pawn2 != null && pawn2 != pawn && !pawn2.InBed() && pawn2.RaceProps.IsFlesh && HealthAIUtility.ShouldHaveSurgeryDoneNow(pawn2)) { LocalTargetInfo target = pawn2; if (pawn.CanReserve(target, 1, -1, null, forced) && (!pawn2.InMentalState || !pawn2.MentalStateDef.IsAggro)) { if (!pawn2.Downed) { if (pawn2.IsColonist) { return(false); } if (!pawn2.IsPrisonerOfColony && pawn2.Faction != Faction.OfPlayer) { return(false); } if (pawn2.guest != null && pawn2.guest.Released) { return(false); } } Building_Bed building_Bed = base.FindBed(pawn, pawn2); return(building_Bed != null && pawn2.CanReserve(building_Bed, building_Bed.SleepingSlotsCount, -1, null, false)); } } return(false); }
public override float GetScore(Room room) { int num = 0; int num2 = 0; List <Thing> containedAndAdjacentThings = room.ContainedAndAdjacentThings; for (int i = 0; i < containedAndAdjacentThings.Count; i++) { Thing thing = containedAndAdjacentThings[i]; Building_Bed building_Bed = thing as Building_Bed; if (building_Bed != null && building_Bed.def.building.bed_humanlike) { if (!building_Bed.ForPrisoners) { return(0f); } if (building_Bed.Medical) { num++; } else { num2++; } } } if (num2 + num <= 1) { return(0f); } return((float)num2 * 100100f + (float)num * 50001f); }
protected override Job TryGiveJob(Pawn pawn) { Predicate <Thing> validator = delegate(Thing t) { Pawn pawn3 = (Pawn)t; if (pawn3.Downed && pawn3.Faction == pawn.Faction && !pawn3.InBed() && pawn.CanReserve(pawn3, 1, -1, null, false) && !pawn3.IsForbidden(pawn) && !GenAI.EnemyIsNear(pawn3, 25f)) { return(true); } return(false); }; Pawn pawn2 = (Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), this.radius, validator, null, 0, -1, false, RegionType.Set_Passable, false); if (pawn2 == null) { return(null); } Building_Bed building_Bed = RestUtility.FindBedFor(pawn2, pawn, pawn2.HostFaction == pawn.Faction, false, false); if (building_Bed != null && pawn2.CanReserve(building_Bed, 1, -1, null, false)) { Job job = new Job(JobDefOf.Rescue, pawn2, building_Bed); job.count = 1; return(job); } return(null); }
public static Pawn GetMostDislikedNonPartnerBedOwner(Pawn p) { Building_Bed ownedBed = p.ownership.OwnedBed; if (ownedBed == null) { return null; } Pawn pawn = null; int num = 0; for (int i = 0; i < ownedBed.owners.Count; i++) { if (ownedBed.owners[i] != p) { if (!LovePartnerRelationUtility.LovePartnerRelationExists(p, ownedBed.owners[i])) { int num2 = p.relations.OpinionOf(ownedBed.owners[i]); if (pawn == null || num2 < num) { pawn = ownedBed.owners[i]; num = num2; } } } } return pawn; }
protected override Job TryGiveJob(Pawn pawn) { Predicate <Thing> validator = delegate(Thing t) { Pawn pawn3 = (Pawn)t; if (!pawn3.Downed || pawn3.Faction != pawn.Faction || pawn3.InBed() || !pawn.CanReserve(pawn3) || pawn3.IsForbidden(pawn) || GenAI.EnemyIsNear(pawn3, 25f)) { return(false); } return(true); }; Pawn pawn2 = (Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(pawn), radius, validator); if (pawn2 == null) { return(null); } Building_Bed building_Bed = RestUtility.FindBedFor(pawn2, pawn, pawn2.HostFaction == pawn.Faction, checkSocialProperness: false); if (building_Bed == null || !pawn2.CanReserve(building_Bed)) { return(null); } Job job = new Job(JobDefOf.Rescue, pawn2, building_Bed); job.count = 1; return(job); }
public static Toil GotoBed(TargetIndex bedIndex) { Toil gotoBed = new Toil(); gotoBed.initAction = delegate() { Pawn actor = gotoBed.actor; Building_Bed bed = (Building_Bed)actor.CurJob.GetTarget(bedIndex).Thing; IntVec3 bedSleepingSlotPosFor = RestUtility.GetBedSleepingSlotPosFor(actor, bed); if (actor.Position == bedSleepingSlotPosFor) { actor.jobs.curDriver.ReadyForNextToil(); } else { actor.pather.StartPath(bedSleepingSlotPosFor, PathEndMode.OnCell); } }; gotoBed.tickAction = delegate() { Pawn actor = gotoBed.actor; Building_Bed building_Bed = (Building_Bed)actor.CurJob.GetTarget(bedIndex).Thing; Pawn curOccupantAt = building_Bed.GetCurOccupantAt(actor.pather.Destination.Cell); if (curOccupantAt != null && curOccupantAt != actor) { actor.pather.StartPath(RestUtility.GetBedSleepingSlotPosFor(actor, building_Bed), PathEndMode.OnCell); } }; gotoBed.defaultCompleteMode = ToilCompleteMode.PatherArrival; gotoBed.FailOnBedNoLongerUsable(bedIndex); return(gotoBed); }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { Pawn pawn2 = t as Pawn; if (pawn2 == null || pawn2 == pawn || pawn2.InBed() || !pawn2.RaceProps.IsFlesh || !HealthAIUtility.ShouldHaveSurgeryDoneNow(pawn2) || !pawn.CanReserve(pawn2, 1, -1, null, forced) || (pawn2.InMentalState && pawn2.MentalStateDef.IsAggro)) { return(false); } if (!pawn2.Downed) { if (pawn2.IsColonist) { return(false); } if (!pawn2.IsPrisonerOfColony && pawn2.Faction != Faction.OfPlayer) { return(false); } if (pawn2.guest != null && pawn2.guest.Released) { return(false); } } Building_Bed building_Bed = FindBed(pawn, pawn2); if (building_Bed != null && pawn2.CanReserve(building_Bed, building_Bed.SleepingSlotsCount)) { return(true); } return(false); }
internal void <> m__0() { Pawn actor = this.layDown.actor; actor.pather.StopDead(); JobDriver curDriver = actor.jobs.curDriver; if (this.hasBed) { Building_Bed t = (Building_Bed)actor.CurJob.GetTarget(this.bedOrRestSpotIndex).Thing; if (!t.OccupiedRect().Contains(actor.Position)) { Log.Error("Can't start LayDown toil because pawn is not in the bed. pawn=" + actor, false); actor.jobs.EndCurrentJob(JobCondition.Errored, true); return; } actor.jobs.posture = PawnPosture.LayingInBed; } else { actor.jobs.posture = PawnPosture.LayingOnGroundNormal; } curDriver.asleep = false; if (actor.mindState.applyBedThoughtsTick == 0) { actor.mindState.applyBedThoughtsTick = Find.TickManager.TicksGame + Rand.Range(2500, 10000); actor.mindState.applyBedThoughtsOnLeave = false; } if (actor.ownership != null && actor.CurrentBed() != actor.ownership.OwnedBed) { ThoughtUtility.RemovePositiveBedroomThoughts(actor); } }
public static Building_Bed FindBedFor(Pawn sleeper, Pawn traveler, bool sleeperWillBePrisoner, bool checkSocialProperness, bool ignoreOtherReservations = false) { if (HealthAIUtility.ShouldSeekMedicalRest(sleeper)) { if (sleeper.InBed() && sleeper.CurrentBed().Medical&& IsValidBedFor(sleeper.CurrentBed(), sleeper, traveler, sleeperWillBePrisoner, checkSocialProperness, allowMedBedEvenIfSetToNoCare: false, ignoreOtherReservations)) { return(sleeper.CurrentBed()); } for (int i = 0; i < bedDefsBestToWorst_Medical.Count; i++) { ThingDef thingDef = bedDefsBestToWorst_Medical[i]; if (!CanUseBedEver(sleeper, thingDef)) { continue; } for (int j = 0; j < 2; j++) { Danger maxDanger2 = ((j == 0) ? Danger.None : Danger.Deadly); Building_Bed building_Bed = (Building_Bed)GenClosest.ClosestThingReachable(sleeper.Position, sleeper.Map, ThingRequest.ForDef(thingDef), PathEndMode.OnCell, TraverseParms.For(traveler), 9999f, (Thing b) => ((Building_Bed)b).Medical && (int)b.Position.GetDangerFor(sleeper, sleeper.Map) <= (int)maxDanger2 && IsValidBedFor(b, sleeper, traveler, sleeperWillBePrisoner, checkSocialProperness, allowMedBedEvenIfSetToNoCare: false, ignoreOtherReservations)); if (building_Bed != null) { return(building_Bed); } } } } if (sleeper.ownership != null && sleeper.ownership.OwnedBed != null && IsValidBedFor(sleeper.ownership.OwnedBed, sleeper, traveler, sleeperWillBePrisoner, checkSocialProperness, allowMedBedEvenIfSetToNoCare: false, ignoreOtherReservations)) { return(sleeper.ownership.OwnedBed); } DirectPawnRelation directPawnRelation = LovePartnerRelationUtility.ExistingMostLikedLovePartnerRel(sleeper, allowDead: false); if (directPawnRelation != null) { Building_Bed ownedBed = directPawnRelation.otherPawn.ownership.OwnedBed; if (ownedBed != null && IsValidBedFor(ownedBed, sleeper, traveler, sleeperWillBePrisoner, checkSocialProperness, allowMedBedEvenIfSetToNoCare: false, ignoreOtherReservations)) { return(ownedBed); } } for (int k = 0; k < 2; k++) { Danger maxDanger = ((k == 0) ? Danger.None : Danger.Deadly); for (int l = 0; l < bedDefsBestToWorst_RestEffectiveness.Count; l++) { ThingDef thingDef2 = bedDefsBestToWorst_RestEffectiveness[l]; if (CanUseBedEver(sleeper, thingDef2)) { Building_Bed building_Bed2 = (Building_Bed)GenClosest.ClosestThingReachable(sleeper.Position, sleeper.Map, ThingRequest.ForDef(thingDef2), PathEndMode.OnCell, TraverseParms.For(traveler), 9999f, (Thing b) => !((Building_Bed)b).Medical && (int)b.Position.GetDangerFor(sleeper, sleeper.Map) <= (int)maxDanger && IsValidBedFor(b, sleeper, traveler, sleeperWillBePrisoner, checkSocialProperness, allowMedBedEvenIfSetToNoCare: false, ignoreOtherReservations)); if (building_Bed2 != null) { return(building_Bed2); } } } } return(null); }
public static bool CanWatchFromBed(Pawn pawn, Building_Bed bed, Thing toWatch) { if (!EverPossibleToWatchFrom(pawn.Position, toWatch.Position, pawn.Map, bedAllowed: true)) { return(false); } if (toWatch.def.rotatable) { Rot4 rotation = bed.Rotation; CellRect cellRect = toWatch.OccupiedRect(); if (rotation == Rot4.North) { int maxZ = cellRect.maxZ; IntVec3 position = pawn.Position; if (maxZ < position.z) { return(false); } } if (rotation == Rot4.South) { int minZ = cellRect.minZ; IntVec3 position2 = pawn.Position; if (minZ > position2.z) { return(false); } } if (rotation == Rot4.East) { int maxX = cellRect.maxX; IntVec3 position3 = pawn.Position; if (maxX < position3.x) { return(false); } } if (rotation == Rot4.West) { int minX = cellRect.minX; IntVec3 position4 = pawn.Position; if (minX > position4.x) { return(false); } } } List <int> list = CalculateAllowedDirections(toWatch.def, toWatch.Rotation); for (int i = 0; i < list.Count; i++) { if (GetWatchCellRect(toWatch.def, toWatch.Position, toWatch.Rotation, list[i]).Contains(pawn.Position)) { return(true); } } return(false); }
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { Pawn pawn2 = t as Pawn; Building_Bed t2 = FindBed(pawn, pawn2); Job job = new Job(JobDefOf.TakeToBedToOperate, pawn2, t2); job.count = 1; return(job); }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo g in base.GetGizmos()) { yield return(g); } if (this.def.building.bed_humanlike && base.Faction == Faction.OfPlayer) { Command_Toggle pris = new Command_Toggle(); pris.defaultLabel = "CommandBedSetForPrisonersLabel".Translate(); pris.defaultDesc = "CommandBedSetForPrisonersDesc".Translate(); pris.icon = ContentFinder <Texture2D> .Get("UI/Commands/ForPrisoners", true); pris.isActive = new Func <bool>(this.get_ForPrisoners); pris.toggleAction = delegate() { this.ToggleForPrisonersByInterface(); }; if (!Building_Bed.RoomCanBePrisonCell(this.GetRoom(RegionType.Set_Passable)) && !this.ForPrisoners) { pris.Disable("CommandBedSetForPrisonersFailOutdoors".Translate()); } pris.hotKey = KeyBindingDefOf.Misc3; pris.turnOffSound = null; pris.turnOnSound = null; yield return(pris); yield return(new Command_Toggle { defaultLabel = "CommandBedSetAsMedicalLabel".Translate(), defaultDesc = "CommandBedSetAsMedicalDesc".Translate(), icon = ContentFinder <Texture2D> .Get("UI/Commands/AsMedical", true), isActive = new Func <bool>(this.get_Medical), toggleAction = delegate() { this.Medical = !this.Medical; }, hotKey = KeyBindingDefOf.Misc2 }); if (!this.ForPrisoners && !this.Medical) { yield return(new Command_Action { defaultLabel = "CommandBedSetOwnerLabel".Translate(), icon = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner", true), defaultDesc = "CommandBedSetOwnerDesc".Translate(), action = delegate() { Find.WindowStack.Add(new Dialog_AssignBuildingOwner(this)); }, hotKey = KeyBindingDefOf.Misc3 }); } } yield break; }
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { Pawn pawn2 = t as Pawn; Building_Bed t2 = base.FindBed(pawn, pawn2); return(new Job(JobDefOf.TakeToBedToOperate, pawn2, t2) { count = 1 }); }
public override void DrawExtraSelectionOverlays() { base.DrawExtraSelectionOverlays(); Room room = this.GetRoom(RegionType.Set_Passable); if (room != null && Building_Bed.RoomCanBePrisonCell(room)) { room.DrawFieldEdges(); } }
private static bool TryToShareBed_Int(Pawn bedOwner, Pawn otherPawn) { Building_Bed ownedBed = bedOwner.ownership.OwnedBed; if (ownedBed != null && ownedBed.AnyUnownedSleepingSlot) { otherPawn.ownership.ClaimBedIfNonMedical(ownedBed); return true; } return false; }
protected override bool ShouldShowAssignmentGizmo() { Building_Bed building_Bed = (Building_Bed)parent; if (building_Bed.def.building.bed_humanlike && building_Bed.Faction == Faction.OfPlayer && !building_Bed.ForPrisoners) { return(!building_Bed.Medical); } return(false); }
public static bool ShouldBeFed(Pawn p) { bool result; if (p.GetPosture() == PawnPosture.Standing) { result = false; } else { if (p.NonHumanlikeOrWildMan()) { Building_Bed building_Bed = p.CurrentBed(); if (building_Bed == null || building_Bed.Faction != Faction.OfPlayer) { return(false); } } else { if (p.Faction != Faction.OfPlayer && p.HostFaction != Faction.OfPlayer) { return(false); } if (!p.InBed()) { return(false); } } if (!p.RaceProps.EatsFood) { result = false; } else if (!HealthAIUtility.ShouldSeekMedicalRest(p)) { result = false; } else { if (p.HostFaction != null) { if (p.HostFaction != Faction.OfPlayer) { return(false); } if (p.guest != null && !p.guest.CanBeBroughtFood) { return(false); } } result = true; } } return(result); }
internal void <> m__1() { Pawn actor = this.gotoBed.actor; Building_Bed building_Bed = (Building_Bed)actor.CurJob.GetTarget(this.bedIndex).Thing; Pawn curOccupantAt = building_Bed.GetCurOccupantAt(actor.pather.Destination.Cell); if (curOccupantAt != null && curOccupantAt != actor) { actor.pather.StartPath(RestUtility.GetBedSleepingSlotPosFor(actor, building_Bed), PathEndMode.OnCell); } }
private static bool IsAnyOwnerLovePartnerOf(Building_Bed bed, Pawn sleeper) { for (int i = 0; i < bed.owners.Count; i++) { if (LovePartnerRelationUtility.LovePartnerRelationExists(sleeper, bed.owners[i])) { return(true); } } return(false); }
private static void ApplyBedThoughts(Pawn actor) { if (actor.needs.mood == null) { return; } Building_Bed building_Bed = actor.CurrentBed(); actor.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.SleptInBedroom); actor.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.SleptInBarracks); actor.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.SleptOutside); actor.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.SleptOnGround); actor.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.SleptInCold); actor.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.SleptInHeat); if (actor.GetRoom().PsychologicallyOutdoors) { actor.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.SleptOutside); } if (building_Bed == null || building_Bed.CostListAdjusted().Count == 0) { actor.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.SleptOnGround); } if (actor.AmbientTemperature < actor.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMin)) { actor.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.SleptInCold); } if (actor.AmbientTemperature > actor.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMax)) { actor.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.SleptInHeat); } if (building_Bed == null || building_Bed != actor.ownership.OwnedBed || building_Bed.ForPrisoners || actor.story.traits.HasTrait(TraitDefOf.Ascetic)) { return; } ThoughtDef thoughtDef = null; if (building_Bed.GetRoom().Role == RoomRoleDefOf.Bedroom) { thoughtDef = ThoughtDefOf.SleptInBedroom; } else if (building_Bed.GetRoom().Role == RoomRoleDefOf.Barracks) { thoughtDef = ThoughtDefOf.SleptInBarracks; } if (thoughtDef != null) { int scoreStageIndex = RoomStatDefOf.Impressiveness.GetScoreStageIndex(building_Bed.GetRoom().GetStat(RoomStatDefOf.Impressiveness)); if (thoughtDef.stages[scoreStageIndex] != null) { actor.needs.mood.thoughts.memories.TryGainMemory(ThoughtMaker.MakeThought(thoughtDef, scoreStageIndex)); } } }
protected override bool CanInteractWith(Pawn pawn, Thing t, bool inBed) { if (!base.CanInteractWith(pawn, t, inBed)) { return(false); } if (inBed) { Building_Bed bed = pawn.CurrentBed(); return(WatchBuildingUtility.CanWatchFromBed(pawn, bed, t)); } return(true); }
public static bool ShouldBeFed(Pawn p) { if (p.GetPosture() == PawnPosture.Standing) { return(false); } if (p.NonHumanlikeOrWildMan()) { Building_Bed building_Bed = p.CurrentBed(); if (building_Bed == null || building_Bed.Faction != Faction.OfPlayer) { return(false); } } else { if (p.Faction != Faction.OfPlayer && p.HostFaction != Faction.OfPlayer) { return(false); } if (!p.InBed()) { return(false); } } if (!p.RaceProps.EatsFood) { return(false); } if (p.Spawned && p.Map.designationManager.DesignationOn(p, DesignationDefOf.Slaughter) != null) { return(false); } if (!HealthAIUtility.ShouldSeekMedicalRest(p)) { return(false); } if (p.HostFaction != null) { if (p.HostFaction != Faction.OfPlayer) { return(false); } if (p.guest != null && !p.guest.CanBeBroughtFood) { return(false); } } return(true); }
internal void <> m__0() { Pawn actor = this.gotoBed.actor; Building_Bed bed = (Building_Bed)actor.CurJob.GetTarget(this.bedIndex).Thing; IntVec3 bedSleepingSlotPosFor = RestUtility.GetBedSleepingSlotPosFor(actor, bed); if (actor.Position == bedSleepingSlotPosFor) { actor.jobs.curDriver.ReadyForNextToil(); } else { actor.pather.StartPath(bedSleepingSlotPosFor, PathEndMode.OnCell); } }
private Job TakeDownedToBedJob(Pawn prisoner, Pawn warden) { if (prisoner.Downed && HealthAIUtility.ShouldSeekMedicalRestUrgent(prisoner) && !prisoner.InBed() && warden.CanReserve(prisoner, 1, -1, null, false)) { Building_Bed building_Bed = RestUtility.FindBedFor(prisoner, warden, true, true, false); if (building_Bed != null) { Job job = new Job(JobDefOf.TakeWoundedPrisonerToBed, prisoner, building_Bed); job.count = 1; return(job); } return(null); } return(null); }
public override float GetScore(Room room) { int num = 0; List <Thing> containedAndAdjacentThings = room.ContainedAndAdjacentThings; for (int i = 0; i < containedAndAdjacentThings.Count; i++) { Building_Bed building_Bed = containedAndAdjacentThings[i] as Building_Bed; if (building_Bed != null && !building_Bed.def.building.bed_humanlike) { num++; } } return((float)num * 7.6f); }
public void ExposeData() { Building_Grave refee = AssignedGrave; Building_Throne refee2 = AssignedThrone; Building refee3 = AssignedMeditationSpot; Scribe_References.Look(ref intOwnedBed, "ownedBed"); Scribe_References.Look(ref refee3, "assignedMeditationSpot"); Scribe_References.Look(ref refee, "assignedGrave"); Scribe_References.Look(ref refee2, "assignedThrone"); AssignedGrave = refee; AssignedThrone = refee2; AssignedMeditationSpot = refee3; if (Scribe.mode != LoadSaveMode.PostLoadInit) { return; } if (intOwnedBed != null) { CompAssignableToPawn compAssignableToPawn = intOwnedBed.TryGetComp <CompAssignableToPawn>(); if (compAssignableToPawn != null && !compAssignableToPawn.AssignedPawns.Contains(pawn)) { Building_Bed newBed = intOwnedBed; UnclaimBed(); ClaimBedIfNonMedical(newBed); } } if (AssignedGrave != null) { CompAssignableToPawn compAssignableToPawn2 = AssignedGrave.TryGetComp <CompAssignableToPawn>(); if (compAssignableToPawn2 != null && !compAssignableToPawn2.AssignedPawns.Contains(pawn)) { Building_Grave assignedGrave = AssignedGrave; UnclaimGrave(); ClaimGrave(assignedGrave); } } if (AssignedThrone != null) { CompAssignableToPawn compAssignableToPawn3 = AssignedThrone.TryGetComp <CompAssignableToPawn>(); if (compAssignableToPawn3 != null && !compAssignableToPawn3.AssignedPawns.Contains(pawn)) { Building_Throne assignedThrone = AssignedThrone; UnclaimThrone(); ClaimThrone(assignedThrone); } } }
private Job TakeDownedToBedJob(Pawn prisoner, Pawn warden) { if (!prisoner.Downed || !HealthAIUtility.ShouldSeekMedicalRestUrgent(prisoner) || prisoner.InBed() || !warden.CanReserve(prisoner)) { return(null); } Building_Bed building_Bed = RestUtility.FindBedFor(prisoner, warden, sleeperWillBePrisoner: true, checkSocialProperness: true); if (building_Bed != null) { Job job = JobMaker.MakeJob(JobDefOf.TakeWoundedPrisonerToBed, prisoner, building_Bed); job.count = 1; return(job); } return(null); }