feat: add safe rooms and repeatable Bobka rations
This commit is contained in:
@@ -33,6 +33,29 @@ func _init(new_map: GridMapState, new_seed: int = 0, new_floor_number: int = 0)
|
||||
seed = new_seed
|
||||
floor_number = new_floor_number
|
||||
|
||||
func room_at(cell: Vector2i) -> RoomState:
|
||||
var room_id := map.get_room_id(cell)
|
||||
for room: RoomState in rooms:
|
||||
if room.id == room_id:
|
||||
return room
|
||||
return null
|
||||
|
||||
func safe_rooms() -> Array[RoomState]:
|
||||
var safe_rooms: Array[RoomState] = []
|
||||
for room: RoomState in rooms:
|
||||
if room.kind in [&"refuge", &"sanctuary"] and not room.bounds.has_point(entrance):
|
||||
safe_rooms.append(room)
|
||||
return safe_rooms
|
||||
|
||||
func bed_cells_in(room: RoomState) -> Array[Vector2i]:
|
||||
var beds: Array[Vector2i] = []
|
||||
if room == null:
|
||||
return beds
|
||||
for cell: Vector2i in metadata.get("bed_cells", []):
|
||||
if room.bounds.has_point(cell):
|
||||
beds.append(cell)
|
||||
return beds
|
||||
|
||||
func to_dict() -> Dictionary:
|
||||
var serialized_rooms: Array[Dictionary] = []
|
||||
for room in rooms:
|
||||
|
||||
Reference in New Issue
Block a user