Fix wrong offset logic in next map selector
This commit is contained in:
parent
e93a19f075
commit
31ed99b22c
1 changed files with 2 additions and 4 deletions
|
@ -15,9 +15,6 @@ do
|
||||||
table.insert(dirs, ".")
|
table.insert(dirs, ".")
|
||||||
for _, dir in pairs(dirs) do
|
for _, dir in pairs(dirs) do
|
||||||
local files = minetest.get_dir_list(mapdir .. dir, false)
|
local files = minetest.get_dir_list(mapdir .. dir, false)
|
||||||
-- if dir ~= "" then
|
|
||||||
-- dir = dir .. "/"
|
|
||||||
-- end
|
|
||||||
for i=1, #files do
|
for i=1, #files do
|
||||||
files_hash[dir .. "/" .. files[i]:split(".")[1]] = true
|
files_hash[dir .. "/" .. files[i]:split(".")[1]] = true
|
||||||
end
|
end
|
||||||
|
@ -27,6 +24,7 @@ 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))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +120,7 @@ ctf_match.register_on_new_match(function()
|
||||||
local idx
|
local idx
|
||||||
if ctf_map.map then
|
if ctf_map.map then
|
||||||
idx = math.random(#ctf_map.available_maps - 1)
|
idx = math.random(#ctf_map.available_maps - 1)
|
||||||
if idx == ctf_map.map.idx then
|
if idx >= ctf_map.map.idx then
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue