Maps catalog: Abort if no maps are available (#412)
This commit is contained in:
parent
abbd62acc8
commit
9956606899
1 changed files with 4 additions and 1 deletions
|
@ -83,6 +83,9 @@ end)
|
||||||
minetest.register_chatcommand("maps", {
|
minetest.register_chatcommand("maps", {
|
||||||
privs = {interact = true},
|
privs = {interact = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
if #ctf_map.available_maps == 0 then
|
||||||
|
return false, "No maps are available!"
|
||||||
|
end
|
||||||
if not minetest.get_player_by_name(name) then
|
if not minetest.get_player_by_name(name) then
|
||||||
return false, "You must be online to view the maps catalog!"
|
return false, "You must be online to view the maps catalog!"
|
||||||
end
|
end
|
||||||
|
@ -104,7 +107,7 @@ minetest.register_chatcommand("maps", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
idx = indices[name] or ctf_map.map.idx
|
idx = indices[name] or ctf_map.map and ctf_map.map.idx or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
show_catalog(name, idx or 1)
|
show_catalog(name, idx or 1)
|
||||||
|
|
Loading…
Reference in a new issue