This commit is contained in:
@@ -1,19 +1,9 @@
|
||||
MapBedroom = {
|
||||
"10101010101010101010101010101010",
|
||||
"10141410101010101010101010101010",
|
||||
"10141410101010101010101010101010",
|
||||
"10101010101010101010101010101010",
|
||||
"10101010101010101010101010101010",
|
||||
"10101010101010101010101010101010",
|
||||
"10101010101010101010101010101010",
|
||||
"10101010101010101010101010101010",
|
||||
"10101010101010101010101010101010",
|
||||
"11111111111111111111111111111111",
|
||||
"11111111111111111111111111111111",
|
||||
"11111111111111111111111111111111",
|
||||
"11111516111213111111111111111111",
|
||||
"11111111111111111111111111111111",
|
||||
"11111111111111111111111111111111",
|
||||
"11111111111111111111111111111111",
|
||||
"11111111111111111111111111111111"
|
||||
}
|
||||
MapManager.register({
|
||||
id = "bedroom",
|
||||
from_x = 0,
|
||||
from_y = 0,
|
||||
width = 30,
|
||||
height = 17,
|
||||
to_x = 0,
|
||||
to_y = 0,
|
||||
})
|
||||
37
inc/map/map.manager.lua
Normal file
37
inc/map/map.manager.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
MapManager = {}
|
||||
|
||||
local _maps = {}
|
||||
|
||||
function MapManager.get_maps_array()
|
||||
local maps_array = {}
|
||||
for _, map_data in pairs(_maps) do
|
||||
table.insert(maps_array, map_data)
|
||||
end
|
||||
return maps_array
|
||||
end
|
||||
|
||||
function MapManager.register(map_data)
|
||||
if _maps[map_data.id] then
|
||||
trace("Warning: Overwriting map with id: " .. map_data.id)
|
||||
end
|
||||
_maps[map_data.id] = map_data
|
||||
end
|
||||
|
||||
function MapManager.get_by_id(map_id)
|
||||
return _maps[map_id]
|
||||
end
|
||||
|
||||
function MapManager.draw(map_id)
|
||||
local map_data = MapManager.get_by_id(map_id)
|
||||
if not map_data then
|
||||
return
|
||||
end
|
||||
map(
|
||||
map_data.from_x,
|
||||
map_data.from_y,
|
||||
map_data.width,
|
||||
map_data.height,
|
||||
map_data.to_x,
|
||||
map_data.to_y
|
||||
)
|
||||
end
|
||||
Reference in New Issue
Block a user