Ejemplo n.º 1
0
 public void Notify_RoomShapeOrContainedBedsChanged()
 {
     this.cachedCellCount     = -1;
     this.cachedOpenRoofCount = -1;
     if (Current.ProgramState == ProgramState.Playing && !this.Fogged)
     {
         this.Map.autoBuildRoofAreaSetter.TryGenerateAreaFor(this);
     }
     this.isPrisonCell = false;
     if (Building_Bed.RoomCanBePrisonCell(this))
     {
         List <Thing> containedAndAdjacentThings = this.ContainedAndAdjacentThings;
         for (int i = 0; i < containedAndAdjacentThings.Count; i++)
         {
             Building_Bed building_Bed = containedAndAdjacentThings[i] as Building_Bed;
             if (building_Bed != null && building_Bed.ForPrisoners)
             {
                 this.isPrisonCell = true;
                 break;
             }
         }
     }
     if (Current.ProgramState == ProgramState.Playing && this.isPrisonCell)
     {
         foreach (Building_Bed containedBed in this.ContainedBeds)
         {
             containedBed.ForPrisoners = true;
         }
     }
     this.lastChangeTick    = Find.TickManager.TicksGame;
     this.statsAndRoleDirty = true;
     FacilitiesUtility.NotifyFacilitiesAboutChangedLOSBlockers(this.regions);
 }
        public override void DrawExtraSelectionOverlays()
        {
            base.DrawExtraSelectionOverlays();
            Room room = this.GetRoom(RegionType.Set_Passable);

            if (room != null && Building_Bed.RoomCanBePrisonCell(room))
            {
                room.DrawFieldEdges();
            }
        }
Ejemplo n.º 3
0
        public static bool Notify_RoomShapeOrContainedBedsChanged(Room __instance)
        {
            lock (__instance)
            {
                cachedCellCount(__instance)     = -1;
                cachedOpenRoofCount(__instance) = -1;
                cachedOpenRoofState(__instance) = null;
                if (Current.ProgramState == ProgramState.Playing && !__instance.Fogged)
                {
                    __instance.Map.autoBuildRoofAreaSetter.TryGenerateAreaFor(__instance);
                }

                __instance.isPrisonCell = false;
                if (Building_Bed.RoomCanBePrisonCell(__instance))
                {
                    List <Thing> containedAndAdjacentThings = __instance.ContainedAndAdjacentThings;
                    for (int i = 0; i < containedAndAdjacentThings.Count; i++)
                    {
                        Building_Bed building_Bed = containedAndAdjacentThings[i] as Building_Bed;
                        if (building_Bed != null && building_Bed.ForPrisoners)
                        {
                            __instance.isPrisonCell = true;
                            break;
                        }
                    }
                }

                List <Thing> list = __instance.Map.listerThings.ThingsOfDef(ThingDefOf.NutrientPasteDispenser);
                for (int j = 0; j < list.Count; j++)
                {
                    list[j].Notify_ColorChanged();
                }

                if (Current.ProgramState == ProgramState.Playing && __instance.isPrisonCell)
                {
                    foreach (Building_Bed containedBed in __instance.ContainedBeds)
                    {
                        containedBed.ForPrisoners = true;
                    }
                }

                __instance.lastChangeTick     = Find.TickManager.TicksGame;
                statsAndRoleDirty(__instance) = true;
                FacilitiesUtility.NotifyFacilitiesAboutChangedLOSBlockers(__instance.Regions);
            }
            return(false);
        }