1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2024-12-26 02:30:40 +01:00

Add the node inspector, a tool for finding information about nodes. Configurable via the //inspect command.

This commit is contained in:
Anthony Zhang 2013-07-21 17:16:29 -04:00
parent e550604747
commit 0fddd17f23
2 changed files with 42 additions and 6 deletions

View File

@ -2,6 +2,21 @@ Chat Commands
------------- -------------
For more information, see the [README](README.md). For more information, see the [README](README.md).
### //inspect
Enable or disable node inspection.
//inspect on
//inspect off
//inspect 1
//inspect 0
//inspect true
//inspect false
//inspect yes
//inspect no
//inspect enable
//inspect disable
### //reset ### //reset
Reset the region so that it is empty. Reset the region so that it is empty.

View File

@ -49,6 +49,32 @@ worldedit.player_axis = function(name)
return "z", dir.z > 0 and 1 or -1 return "z", dir.z > 0 and 1 or -1
end end
worldedit.inspect = true
minetest.register_chatcommand("/inspect", {
params = "on/off/1/0/true/false/yes/no/enable/disable",
description = "Enable or disable node inspection",
privs = {worldedit=true},
func = function(name, param)
if param == "on" or param == "1" or param == "true" or param == "yes" or param == "enable" then
worldedit.inspect = true
worldedit.player_notify(name, "node inspection is now on")
elseif param == "off" or param == "0" or param == "false" or param == "no" or param == "disable" then
worldedit.inspect = false
worldedit.player_notify(name, "node inspection is now off")
else
worldedit.player_notify(name, "invalid usage: " .. param)
end
end,
})
minetest.register_on_punchnode(function(pos, node, puncher)
if worldedit.inspect then
message = "node inspector: " .. node.name .. " at " .. minetest.pos_to_string(pos) .. " (param1=" .. node.param1 .. ", param2=" .. node.param2 .. ")"
worldedit.player_notify(puncher:get_player_name(), message)
end
end)
minetest.register_chatcommand("/reset", { minetest.register_chatcommand("/reset", {
params = "", params = "",
description = "Reset the region so that it is empty", description = "Reset the region so that it is empty",
@ -205,12 +231,7 @@ minetest.register_chatcommand("/set", {
return return
end end
local tenv = minetest.env local count = worldedit.set(pos1, pos2, node)
if worldedit.ENABLE_QUEUE then
tenv = worldedit.queue_aliasenv
end
local count = worldedit.set(pos1, pos2, node, tenv)
worldedit.player_notify(name, count .. " nodes set") worldedit.player_notify(name, count .. " nodes set")
end, end,
}) })