]> git.lizzy.rs Git - worldedit.git/commitdiff
Add the node inspector, a tool for finding information about nodes. Configurable...
authorAnthony Zhang <azhang9@gmail.com>
Sun, 21 Jul 2013 21:16:29 +0000 (17:16 -0400)
committerAnthony Zhang <azhang9@gmail.com>
Sun, 21 Jul 2013 21:16:29 +0000 (17:16 -0400)
Chat Commands.md
worldedit_commands/init.lua

index 6bd1772628805a4afcdef961fe67dedcb811db38..08adbafc07e4345c419437f6c9cb6386c002cc59 100644 (file)
@@ -2,6 +2,21 @@ Chat Commands
 -------------\r
 For more information, see the [README](README.md).\r
 \r
+### //inspect\r
+\r
+Enable or disable node inspection.\r
+\r
+    //inspect on\r
+    //inspect off\r
+    //inspect 1\r
+    //inspect 0\r
+    //inspect true\r
+    //inspect false\r
+    //inspect yes\r
+    //inspect no\r
+    //inspect enable\r
+    //inspect disable\r
+\r
 ### //reset\r
 \r
 Reset the region so that it is empty.\r
index d75fdbfa884bbacbbaf7d9e4b8c9b11f429acac0..3ef247d17c1b55d7f6fedac5d7876f2e27b32079 100644 (file)
@@ -49,6 +49,32 @@ worldedit.player_axis = function(name)
        return "z", dir.z > 0 and 1 or -1\r
 end\r
 \r
+worldedit.inspect = true\r
+\r
+minetest.register_chatcommand("/inspect", {\r
+       params = "on/off/1/0/true/false/yes/no/enable/disable",\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
+                       worldedit.inspect = true\r
+                       worldedit.player_notify(name, "node inspection is now on")\r
+               elseif param == "off" or param == "0" or param == "false" or param == "no" or param == "disable" then\r
+                       worldedit.inspect = false\r
+                       worldedit.player_notify(name, "node inspection is now off")\r
+               else\r
+                       worldedit.player_notify(name, "invalid usage: " .. param)\r
+               end\r
+       end,\r
+})\r
+\r
+minetest.register_on_punchnode(function(pos, node, puncher)\r
+       if worldedit.inspect then\r
+               message = "node inspector: " .. node.name .. " at " .. minetest.pos_to_string(pos) .. " (param1=" .. node.param1 .. ", param2=" .. node.param2 .. ")"\r
+               worldedit.player_notify(puncher:get_player_name(), message)\r
+       end\r
+end)\r
+\r
 minetest.register_chatcommand("/reset", {\r
        params = "",\r
        description = "Reset the region so that it is empty",\r
@@ -205,12 +231,7 @@ minetest.register_chatcommand("/set", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-\r
-               local count = worldedit.set(pos1, pos2, node, tenv)\r
+               local count = worldedit.set(pos1, pos2, node)\r
                worldedit.player_notify(name, count .. " nodes set")\r
        end,\r
 })\r