Improve error reporting of /spawnstruct

This commit is contained in:
Wuzzy 2017-05-19 15:09:46 +02:00
parent 8e77c897e6
commit 7c85b380b9
1 changed files with 11 additions and 6 deletions

View File

@ -262,17 +262,22 @@ minetest.register_chatcommand("spawnstruct", {
if not pos then if not pos then
return return
end end
if param == "" or param == "help" then local errord = false
minetest.chat_send_player(name, "Please use “/spawnstruct <type>”.")
minetest.chat_send_player(name, "Avaiable types: desert_temple, village")
end
if param == "village" then if param == "village" then
random_struct.generate_village(pos) random_struct.generate_village(pos)
minetest.chat_send_player(name, "Village created.") minetest.chat_send_player(name, "Village created.")
end elseif param == "desert_temple" then
if param == "desert_temple" then
random_struct.generate_desert_temple(pos) random_struct.generate_desert_temple(pos)
minetest.chat_send_player(name, "Desert temple created.") minetest.chat_send_player(name, "Desert temple created.")
elseif param == "" then
minetest.chat_send_player(name, "Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true
else
minetest.chat_send_player(name, "Error: Unknown structure type. Please use “/spawnstruct <type>”.")
errord = true
end
if errord then
minetest.chat_send_player(name, "Avaiable types: desert_temple, village")
end end
end end
}) })