Add map reload feature
This commit is contained in:
parent
d3c8f39372
commit
469347f716
1 changed files with 12 additions and 2 deletions
|
@ -41,7 +41,7 @@ minetest.register_chatcommand("set_next", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
do
|
local function search_for_maps()
|
||||||
local files_hash = {}
|
local files_hash = {}
|
||||||
|
|
||||||
local dirs = minetest.get_dir_list(mapdir, true)
|
local dirs = minetest.get_dir_list(mapdir, true)
|
||||||
|
@ -57,8 +57,18 @@ do
|
||||||
for key, _ in pairs(files_hash) do
|
for key, _ in pairs(files_hash) do
|
||||||
table.insert(ctf_map.available_maps, key)
|
table.insert(ctf_map.available_maps, key)
|
||||||
end
|
end
|
||||||
print(dump(ctf_map.available_maps))
|
return ctf_map.available_maps
|
||||||
end
|
end
|
||||||
|
print(dump(search_for_maps()))
|
||||||
|
|
||||||
|
minetest.register_chatcommand("maps_reload", {
|
||||||
|
privs = { ctf_admin = true },
|
||||||
|
func = function(name, param)
|
||||||
|
local maps = search_for_maps()
|
||||||
|
next_idx = nil
|
||||||
|
return true, #maps .. " maps found: " .. table.concat(maps, ", ")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
function ctf_map.place_map(map)
|
function ctf_map.place_map(map)
|
||||||
|
|
Loading…
Reference in a new issue