Fix bug with map saving

master
LoneWolfHT 2019-06-27 17:37:48 -07:00
parent f5ee057b14
commit 8e42e83874
1 changed files with 7 additions and 4 deletions

View File

@ -42,7 +42,7 @@ minetest.register_chatcommand("maps", {
if not params then return end
if params[1] == "h" or params[1] == "help" then
return true, "Options: help/h | new | edit <mapname> | save [mapname (Only needed for new maps])"
return true, "Options: help/h | new | edit <mapname> | save"
end
if params[1] == "new" then
@ -64,7 +64,7 @@ minetest.register_chatcommand("maps", {
return false, "You aren't editing/creating a map!"
end
else
return false, "Options: help/h | new | edit <mapname> | save [mapname (Only needed for new maps])"
return false, "Options: help/h | new | edit <mapname> | save"
end
end
})
@ -100,6 +100,10 @@ function maps.save_map(pname, mname, creator, skybox, modes)
return false, "You must place at least one player spawner first!"
end
if not minetest.find_node_near(startpos, 20, "maps:itemspawner", true) then
return false, "You must place at least one item spawner first!"
end
if not conf then return false, error end
if maps.map_exists(mname) and editors[pname].map and editors[pname].map == mname then
minetest.chat_send_player(pname, "Overwriting map "..dump(mname).."...")
@ -263,8 +267,7 @@ end
function maps.show_save_form(player)
local p = minetest.get_player_by_name(player)
minetest.chat_send_all(dump(editors[player]))
if not editors[player] then
if not editors[player] or not editors[player].settings then
editors[player].settings.name = player.."s Map"
editors[player].settings.creator = player
editors[player].settings.skybox = "TropicalSunnyDay"