-
Notifications
You must be signed in to change notification settings - Fork 13
Getting Rooms
NOTE: A room's "position" is a vector representation of a RoomDescriptor's GridIndex. You can convert a grid index to a vector and vice versa using MinimapAPI:GridIndexToVector(GridIndex) and MinimapAPI:GridVectorToIndex(Vector position)
MinimapAPI:GetCurrentRoom()Returns the current room the player is theoretically in (according to their position on the minimap) This will return nil if the player's position does not match up to any room.
MinimapAPI:GetRoom(Vector position)This will return the room if the given position matches its top left ONLY.
MinimapAPI:GetRoomAtPosition(Vector position)This will return a room if it occupies the space given. This includes the bottom right of large rooms.
MinimapAPI:GetRoomByIdx(GridIndex index)Returns one room in the level with the given RoomDescriptor GridIndex.
MinimapAPI:GetRoomByID(id)Returns one room in the level with the given ID. So don't add more than one room with the same ID.
for _,room in ipairs(MinimapAPI:GetLevel()) do
if room:GetDisplayFlags() > 0 then
print("This room is visible!")
end
endAn example of a function iterating through all rooms of the current dimension.