})\r
\r
minetest.register_chatcommand("/inspect", {\r
- params = "on/off/1/0/true/false/yes/no/enable/disable",\r
+ params = "on/off/1/0/true/false/yes/no/enable/disable/<blank>",\r
description = "Enable or disable node inspection",\r
privs = {worldedit=true},\r
func = function(name, param)\r
- if param == "on" or param == "1" or param == "true" or param == "yes" or param == "enable" then\r
+ if param == "on" or param == "1" or param == "true" or param == "yes" or param == "enable" or param == "" then\r
worldedit.inspect[name] = true\r
- worldedit.player_notify(name, "node inspection enabled")\r
+ local axis, sign = worldedit.player_axis(name)\r
+ worldedit.player_notify(name, string.format("inspector: inspection enabled for %s, currently facing the %s axis",\r
+ name, axis .. (sign > 0 and "+" or "-")))\r
elseif param == "off" or param == "0" or param == "false" or param == "no" or param == "disable" then\r
worldedit.inspect[name] = nil\r
- worldedit.player_notify(name, "node inspection disabled")\r
+ worldedit.player_notify(name, "inspector: inspection disabled")\r
else\r
worldedit.player_notify(name, "invalid usage: " .. param)\r
end\r
local name = puncher:get_player_name()\r
if worldedit.inspect[name] then\r
if minetest.check_player_privs(name, {worldedit=true}) then\r
- message = "inspector: " .. node.name .. " at " .. minetest.pos_to_string(pos) .. " (param1=" .. node.param1 .. ", param2=" .. node.param2 .. ")"\r
+ local axis, sign = worldedit.player_axis(name)\r
+ message = string.format("inspector: %s at %s (param1=%d, param2=%d) punched by %s facing the %s axis",\r
+ node.name, minetest.pos_to_string(pos), node.param1, node.param2, name, axis .. (sign > 0 and "+" or "-"))\r
else\r
message = "inspector: worldedit privileges required"\r
end\r
end,\r
})\r
\r
-minetest.register_chatcommand("/scale", {\r
- params = "<factor>",\r
- description = "Scale the current WorldEdit positions and region by a factor of positive integer <factor> with position 1 as the origin",\r
+minetest.register_chatcommand("/stretch", {\r
+ params = "<stretchx> <stretchy> <stretchz>",\r
+ description = "Scale the current WorldEdit positions and region by a factor of <stretchx>, <stretchy>, <stretchz> along the X, Y, and Z axes, repectively, with position 1 as the origin",\r
privs = {worldedit=true},\r
func = function(name, param)\r
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]\r
return\r
end\r
\r
- local factor = tonumber(param)\r
- if not factor or factor ~= math.floor(factor) or factor <= 0 then\r
+ local found, _, stretchx, stretchy, stretchz = param:find("^(%d+)%s+(%d+)%s+(%d+)$")\r
+ if found == nil then\r
+ worldedit.player_notify(name, "invalid usage: " .. param)\r
+ return\r
+ end\r
+ stretchx, stretchy, stretchz = tonumber(stretchx), tonumber(stretchy), tonumber(stretchz)\r
+ if stretchx == 0 or stretchy == 0 or stretchz == 0 then\r
worldedit.player_notify(name, "invalid scaling factor: " .. param)\r
end\r
\r
- local count, pos1, pos2 = worldedit.scale(pos1, pos2, factor)\r
+ local count, pos1, pos2 = worldedit.stretch(pos1, pos2, stretchx, stretchy, stretchz)\r
\r
--reset markers to scaled positions\r
worldedit.pos1[name] = pos1\r
worldedit.mark_pos1(name)\r
worldedit.mark_pos2(name)\r
\r
- worldedit.player_notify(name, count .. " nodes scaled")\r
+ worldedit.player_notify(name, count .. " nodes stretched")\r
end,\r
})\r
\r
worldedit.player_notify(name, "invalid usage: " .. param)\r
return\r
end\r
+ if not string.find(param, "^[%w \t.,+-_=!@#$%%^&*()%[%]{};'\"]+$") then\r
+ worldedit.player_notify(name, "invalid file name: " .. param)\r
+ return\r
+ end\r
\r
local result, count = worldedit.serialize(pos1, pos2)\r
\r
worldedit.player_notify(name, "invalid usage: " .. param)\r
return\r
end\r
+ if not string.find(param, "^[%w \t.,+-_=!@#$%%^&*()%[%]{};'\"]+$") then\r
+ worldedit.player_notify(name, "invalid file name: " .. param)\r
+ return\r
+ end\r
\r
local filename = minetest.get_worldpath() .. "/schems/" .. param .. ".we"\r
local file, err = io.open(filename, "rb")\r
worldedit.player_notify(name, "invalid usage: " .. param)\r
return\r
end\r
+ if not string.find(param, "^[%w \t.,+-_=!@#$%%^&*()%[%]{};'\"]+$") then\r
+ worldedit.player_notify(name, "invalid file name: " .. param)\r
+ return\r
+ end\r
\r
--find the file in the world path\r
local testpaths = {\r