From e11b0b336676a20f7322b41ac67fb1159bf4ad21 Mon Sep 17 00:00:00 2001 From: dgm3333 Date: Mon, 26 May 2014 21:26:23 +0100 Subject: [PATCH] Update init.lua add /loadalign command - command to allow loading of a schem file which is aligned to player forward direction (and some helper commands). Also update /allocate and /load to report missing mods --- worldedit_commands/init.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 6a672b6..3db9bbe 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -900,6 +900,7 @@ minetest.register_chatcommand("/load", { func = function(name, param) local pos = get_position(name) if pos == nil then return end + local missingMods = "" if param == "" then worldedit.player_notify(name, "invalid usage: " .. param) @@ -935,9 +936,12 @@ minetest.register_chatcommand("/load", { return end - local count = worldedit.deserialize(pos, value) + local count, missingMods = worldedit.deserialize(pos, value) worldedit.player_notify(name, count .. " nodes loaded") + if missingMods ~= "" then + worldedit.player_notify(name, "Warning: schem file contains references to the following missing mods: ".. missingMods) + end end, }) @@ -1016,6 +1020,7 @@ minetest.register_chatcommand("/loadalign", { local player = minetest.get_player_by_name(name) local plPos = player:getpos() local pos + local missingMods = "" -- There's probably a snazzy way of using patterns to enable multiple optional parameters including a filename, but I don't know how... @@ -1094,7 +1099,7 @@ minetest.register_chatcommand("/loadalign", { if usePlayer == "p" then player:setpos({x=plPos.x, y=plPos.y, z=(plPos.z+1-posOffz)}) end end - local count, pos1, pos2 = worldedit.deserializeAligned(pos, value, axis) + local count, pos1, pos2, missingMods = worldedit.deserializeAligned(pos, value, axis) -- placer pos1 and pos2 markers around the loaded region if markImport == "m" then @@ -1105,6 +1110,9 @@ minetest.register_chatcommand("/loadalign", { end worldedit.player_notify(name, (count .. " nodes loaded. PlayerFacing: ".. axis.. " Location: x=".. pos.x.. " y=".. pos.y.. " z=".. pos.z.. " Offset: x=".. posOffx.. " y=".. posOffy.. " z=".. posOffz )) --.. x ", y=".. y, "z=".. z) + if missingMods ~= "" then + worldedit.player_notify(name, "Warning: schem file contains references to the following missing mods: ".. missingMods) + end end, })