From 0993c6e7c6b330c2db198469327a6b8e825fbf0c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 Sep 2017 03:15:38 +0200 Subject: [PATCH] Fix buggy placeschem command --- init.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 870a7f9..240d41a 100644 --- a/init.lua +++ b/init.lua @@ -928,14 +928,23 @@ minetest.register_chatcommand("placeschem", { params = ".mts [ ]", func = function(name, param) local schem, p = string.match(param, "^([^ ]+) *(.*)$") - local pos = minetest.string_to_pos(p) + local pos = minetest.string_to_pos(p) + + if not schem then + return false, "No schematic file specified." + end if not pos then pos = minetest.get_player_by_name(name):get_pos() end - return true, "Success: "..dump(minetest.place_schematic(pos, - minetest.get_worldpath().."/schems/"..schem..".mts", "random", nil, false)) + local success = minetest.place_schematic(pos, minetest.get_worldpath().."/schems/"..schem..".mts", "random", nil, false) + + if success == nil then + return false, "Schematic file could not be loaded!" + else + return true + end end, })