Add support for sub directories in map dir

This commit is contained in:
rubenwardy 2018-01-22 02:23:53 +00:00
parent 6a53c23f95
commit d5b4e5f1ce
7 changed files with 15 additions and 22 deletions

1
.gitignore vendored
View file

@ -5,6 +5,7 @@
tags
*.vim
debug.txt
mods/ctf_map/maps/*/
## Files related to minetest development cycle
*.patch

View file

@ -1,8 +1,8 @@
name = Two Hills and Two Lakes
author = rubenwardy
rotation = z
h = 140
r = 115
h = 140
team.1 = red
team.1.color = red
team.1.pos = 7,27,93

View file

@ -5,7 +5,7 @@ r = 115
h = 140
team.1 = red
team.1.color = red
team.1.pos = -57,-20,94
team.1.pos = -57,-20,93
team.2 = blue
team.2.color = blue
team.2.pos = -74,-16,-70

View file

@ -1,16 +0,0 @@
name = Caverns
author = rubenwardy
rotation = z
r = 115
h = 230
initial_stuff = default:pick_steel,default:sword_wood,default:torch 20
team.1 = red
team.1.color = red
team.1.pos = -20,-2,65
team.1.chests1 = -63,-4,26
team.1.chests2 = -6,20,73
team.2 = blue
team.2.color = blue
team.2.pos = -48,0,-83
team.2.chests1 = -72,-4,-97
team.2.chests2 = 7,15,-33

Binary file not shown.

View file

@ -10,9 +10,17 @@ ctf_map.map = nil
do
local files_hash = {}
local files = minetest.get_dir_list(mapdir, false)
for i=1, #files do
files_hash[files[i]:split(".")[1]] = true
local dirs = minetest.get_dir_list(mapdir, true)
table.insert(dirs, ".")
for _, dir in pairs(dirs) do
local files = minetest.get_dir_list(mapdir .. dir, false)
-- if dir ~= "" then
-- dir = dir .. "/"
-- end
for i=1, #files do
files_hash[dir .. "/" .. files[i]:split(".")[1]] = true
end
end
ctf_map.available_maps = {}

@ -1 +1 @@
Subproject commit 2601a44b0e65415a20ac495dc1beefd03db5831b
Subproject commit e2a59cef6eba80464af5414d89c4e1c6fbfd597c