public static Room GetRoom(this Thing thing, RegionType allowedRegionTypes = RegionType.Set_Passable)
 {
     if (!thing.Spawned)
     {
         return(null);
     }
     return(RegionAndRoomQuery.RoomAt(thing.Position, thing.Map, allowedRegionTypes));
 }
        public static Room GetRoom(this Thing thing, RegionType allowedRegionTypes = RegionType.Set_Passable)
        {
            Room result;

            if (!thing.Spawned)
            {
                result = null;
            }
            else
            {
                result = RegionAndRoomQuery.RoomAt(thing.Position, thing.Map, allowedRegionTypes);
            }
            return(result);
        }
        public static Room RoomAtOrAdjacent(IntVec3 c, Map map, RegionType allowedRegionTypes = RegionType.Set_Passable)
        {
            Room room = RegionAndRoomQuery.RoomAt(c, map, allowedRegionTypes);

            if (room != null)
            {
                return(room);
            }
            for (int i = 0; i < 8; i++)
            {
                IntVec3 c2 = c + GenAdj.AdjacentCells[i];
                room = RegionAndRoomQuery.RoomAt(c2, map, allowedRegionTypes);
                if (room != null)
                {
                    return(room);
                }
            }
            return(room);
        }
Exemple #4
0
 public static Room GetRoom(this IntVec3 loc, Map map, RegionType allowedRegionTypes = RegionType.Set_Passable)
 {
     return(RegionAndRoomQuery.RoomAt(loc, map, allowedRegionTypes));
 }
        public static RoomGroup RoomGroupAt(IntVec3 c, Map map)
        {
            Room room = RegionAndRoomQuery.RoomAt(c, map, RegionType.Set_All);

            return((room == null) ? null : room.Group);
        }