From 7c85b380b9aa6ff528becef40d5b0035a808029e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 19 May 2017 15:09:46 +0200 Subject: [PATCH] Improve error reporting of /spawnstruct --- mods/MAPGEN/random_struct/init.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mods/MAPGEN/random_struct/init.lua b/mods/MAPGEN/random_struct/init.lua index 0c032eaa2c..fa65a3c707 100644 --- a/mods/MAPGEN/random_struct/init.lua +++ b/mods/MAPGEN/random_struct/init.lua @@ -262,17 +262,22 @@ minetest.register_chatcommand("spawnstruct", { if not pos then return end - if param == "" or param == "help" then - minetest.chat_send_player(name, "Please use “/spawnstruct ”.") - minetest.chat_send_player(name, "Avaiable types: desert_temple, village") - end + local errord = false if param == "village" then random_struct.generate_village(pos) minetest.chat_send_player(name, "Village created.") - end - if param == "desert_temple" then + elseif param == "desert_temple" then random_struct.generate_desert_temple(pos) minetest.chat_send_player(name, "Desert temple created.") + elseif param == "" then + minetest.chat_send_player(name, "Error: No structure type given. Please use “/spawnstruct ”.") + errord = true + else + minetest.chat_send_player(name, "Error: Unknown structure type. Please use “/spawnstruct ”.") + errord = true + end + if errord then + minetest.chat_send_player(name, "Avaiable types: desert_temple, village") end end })