public override AcceptanceReport CanDesignateCell(IntVec3 loc) { var map = Find.CurrentMap; return(RoomRoleFinder.GetRoomAtLocation(loc, map) != null || loc.GetZone(map) != null); }
private void RemoveRoomsWithZones() { if (!_dirty) { return; } _dirty = false; if (!Main.Instance.ShowRoomNames() || !Main.Instance.ShowZoneNames()) { return; } var map = Find.CurrentMap; var roomsToRemove = new HashSet <Room>(); var labelledRooms = new HashSet <Room>( _currentLabels .Where(l => !l.IsZone) .Select(l => l.AssociatedArea as Room) ); foreach (var label in _currentLabels) { if (!label.IsZone) { continue; } // Assume we don't need to handle zones that are both inside and outside a room, // so we only need to test the location of one cell var zone = label.AssociatedArea as Zone; if (zone.Cells.Count < 1) { continue; } var roomWithCell = RoomRoleFinder.GetRoomAtLocation(zone.Cells.First(), map); if (roomWithCell == null) { continue; } if (labelledRooms.Contains(roomWithCell)) { roomsToRemove.Add(roomWithCell); } } foreach (var room in roomsToRemove) { _currentLabels.RemoveAll(l => l.AssociatedArea == room); } }