]> git.lizzy.rs Git - worldedit.git/blobdiff - worldedit_commands/init.lua
Change compatibility notices.
[worldedit.git] / worldedit_commands / init.lua
index 44768a3b97ca1a1f013ae6d5920b622e5b4543c4..99776740baaf6edb55e56c40fab7a417696cee3b 100644 (file)
@@ -38,7 +38,7 @@ end
 \r
 --determines the axis in which a player is facing, returning an axis ("x", "y", or "z") and the sign (1 or -1)\r
 worldedit.player_axis = function(name)\r
-       local dir = minetest.env:get_player_by_name(name):get_look_dir()\r
+       local dir = minetest.get_player_by_name(name):get_look_dir()\r
        local x, y, z = math.abs(dir.x), math.abs(dir.y), math.abs(dir.z)\r
        if x > y then\r
                if x > z then\r
@@ -50,6 +50,14 @@ worldedit.player_axis = function(name)
        return "z", dir.z > 0 and 1 or -1\r
 end\r
 \r
+minetest.register_chatcommand("/about", {\r
+       params = "",\r
+       description = "Get information about the mod",\r
+       func = function(name, param)\r
+               worldedit.player_notify(name, "WorldEdit 1.0 is available on this server. Type /help to get a list of commands, or get more information at https://github.com/Uberi/MineTest-WorldEdit/")\r
+       end,\r
+})\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
@@ -125,7 +133,7 @@ minetest.register_chatcommand("/pos1", {
        description = "Set WorldEdit region position 1 to the player's location",\r
        privs = {worldedit=true},\r
        func = function(name, param)\r
-               local pos = minetest.env:get_player_by_name(name):getpos()\r
+               local pos = minetest.get_player_by_name(name):getpos()\r
                pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)\r
                worldedit.pos1[name] = pos\r
                worldedit.mark_pos1(name)\r
@@ -138,7 +146,7 @@ minetest.register_chatcommand("/pos2", {
        description = "Set WorldEdit region position 2 to the player's location",\r
        privs = {worldedit=true},\r
        func = function(name, param)\r
-               local pos = minetest.env:get_player_by_name(name):getpos()\r
+               local pos = minetest.get_player_by_name(name):getpos()\r
                pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)\r
                worldedit.pos2[name] = pos\r
                worldedit.mark_pos2(name)\r
@@ -294,11 +302,7 @@ minetest.register_chatcommand("/replace", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.replace(pos1, pos2, newsearchnode, newreplacenode, tenv)\r
+               local count = worldedit.replace(pos1, pos2, newsearchnode, newreplacenode)\r
                worldedit.player_notify(name, count .. " nodes replaced")\r
        end,\r
 })\r
@@ -330,11 +334,7 @@ minetest.register_chatcommand("/replaceinverse", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.replaceinverse(pos1, pos2, searchnode, replacenode, tenv)\r
+               local count = worldedit.replaceinverse(pos1, pos2, searchnode, replacenode)\r
                worldedit.player_notify(name, count .. " nodes replaced")\r
        end,\r
 })\r
@@ -361,11 +361,7 @@ minetest.register_chatcommand("/hollowsphere", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.hollow_sphere(pos, tonumber(radius), node, tenv)\r
+               local count = worldedit.hollow_sphere(pos, tonumber(radius), node)\r
                worldedit.player_notify(name, count .. " nodes added")\r
        end,\r
 })\r
@@ -392,11 +388,7 @@ minetest.register_chatcommand("/sphere", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.sphere(pos, tonumber(radius), node, tenv)\r
+               local count = worldedit.sphere(pos, tonumber(radius), node)\r
                worldedit.player_notify(name, count .. " nodes added")\r
        end,\r
 })\r
@@ -423,11 +415,7 @@ minetest.register_chatcommand("/hollowdome", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.hollow_dome(pos, tonumber(radius), node, tenv)\r
+               local count = worldedit.hollow_dome(pos, tonumber(radius), node)\r
                worldedit.player_notify(name, count .. " nodes added")\r
        end,\r
 })\r
@@ -454,11 +442,7 @@ minetest.register_chatcommand("/dome", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.dome(pos, tonumber(radius), node, tenv)\r
+               local count = worldedit.dome(pos, tonumber(radius), node)\r
                worldedit.player_notify(name, count .. " nodes added")\r
        end,\r
 })\r
@@ -490,11 +474,7 @@ minetest.register_chatcommand("/hollowcylinder", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.hollow_cylinder(pos, axis, length, radius, node, tenv)\r
+               local count = worldedit.hollow_cylinder(pos, axis, length, radius, node)\r
                worldedit.player_notify(name, count .. " nodes added")\r
        end,\r
 })\r
@@ -526,11 +506,7 @@ minetest.register_chatcommand("/cylinder", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.cylinder(pos, axis, length, radius, node, tenv)\r
+               local count = worldedit.cylinder(pos, axis, length, radius, node)\r
                worldedit.player_notify(name, count .. " nodes added")\r
        end,\r
 })\r
@@ -568,8 +544,8 @@ minetest.register_chatcommand("/pyramid", {
 })\r
 \r
 minetest.register_chatcommand("/spiral", {\r
-       params = "<width> <height> <space> <node>",\r
-       description = "Add spiral centered at WorldEdit position 1 with width <width>, height <height>, space between walls <space>, composed of <node>",\r
+       params = "<length> <height> <space> <node>",\r
+       description = "Add spiral centered at WorldEdit position 1 with side length <length>, height <height>, space between walls <space>, composed of <node>",\r
        privs = {worldedit=true},\r
        func = function(name, param)\r
                local pos = worldedit.pos1[name]\r
@@ -578,7 +554,7 @@ minetest.register_chatcommand("/spiral", {
                        return\r
                end\r
 \r
-               local found, _, width, height, space, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$")\r
+               local found, _, length, height, space, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$")\r
                if found == nil then\r
                        worldedit.player_notify(name, "invalid usage: " .. param)\r
                        return\r
@@ -589,11 +565,7 @@ minetest.register_chatcommand("/spiral", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.spiral(pos, tonumber(width), tonumber(height), tonumber(space), node, tenv)\r
+               local count = worldedit.spiral(pos, tonumber(length), tonumber(height), tonumber(space), node)\r
                worldedit.player_notify(name, count .. " nodes added")\r
        end,\r
 })\r
@@ -620,11 +592,7 @@ minetest.register_chatcommand("/copy", {
                        amount = amount * sign\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.copy(pos1, pos2, axis, amount, tenv)\r
+               local count = worldedit.copy(pos1, pos2, axis, amount)\r
                worldedit.player_notify(name, count .. " nodes copied")\r
        end,\r
 })\r
@@ -651,11 +619,7 @@ minetest.register_chatcommand("/move", {
                        amount = amount * sign\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.move(pos1, pos2, axis, amount, tenv)\r
+               local count = worldedit.move(pos1, pos2, axis, amount)\r
 \r
                pos1[axis] = pos1[axis] + amount\r
                pos2[axis] = pos2[axis] + amount\r
@@ -687,11 +651,7 @@ minetest.register_chatcommand("/stack", {
                        count = count * sign\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.stack(pos1, pos2, axis, count, tenv)\r
+               local count = worldedit.stack(pos1, pos2, axis, count)\r
                worldedit.player_notify(name, count .. " nodes stacked")\r
        end,\r
 })\r
@@ -712,11 +672,7 @@ minetest.register_chatcommand("/scale", {
                        worldedit.player_notify(name, "invalid scaling factor: " .. param)\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count, pos1, pos2 = worldedit.scale(pos1, pos2, factor, tenv)\r
+               local count, pos1, pos2 = worldedit.scale(pos1, pos2, factor)\r
 \r
                --reset markers to scaled positions\r
                worldedit.pos1[name] = pos1\r
@@ -755,11 +711,7 @@ minetest.register_chatcommand("/transpose", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count, pos1, pos2 = worldedit.transpose(pos1, pos2, axis1, axis2, tenv)\r
+               local count, pos1, pos2 = worldedit.transpose(pos1, pos2, axis1, axis2)\r
 \r
                --reset markers to transposed positions\r
                worldedit.pos1[name] = pos1\r
@@ -790,11 +742,7 @@ minetest.register_chatcommand("/flip", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.flip(pos1, pos2, param, tenv)\r
+               local count = worldedit.flip(pos1, pos2, param)\r
                worldedit.player_notify(name, count .. " nodes flipped")\r
        end,\r
 })\r
@@ -856,11 +804,7 @@ minetest.register_chatcommand("/orient", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.orient(pos1, pos2, angle, tenv)\r
+               local count = worldedit.orient(pos1, pos2, angle)\r
 \r
                worldedit.player_notify(name, count .. " nodes oriented")\r
        end,\r
@@ -877,11 +821,7 @@ minetest.register_chatcommand("/fixlight", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.fixlight(pos1, pos2, tenv)\r
+               local count = worldedit.fixlight(pos1, pos2)\r
                worldedit.player_notify(name, count .. " nodes updated")\r
        end,\r
 })\r
@@ -919,11 +859,7 @@ minetest.register_chatcommand("/suppress", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.suppress(pos1, pos2, node, tenv)\r
+               local count = worldedit.suppress(pos1, pos2, node)\r
                worldedit.player_notify(name, count .. " nodes suppressed")\r
        end,\r
 })\r
@@ -945,11 +881,7 @@ minetest.register_chatcommand("/highlight", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.highlight(pos1, pos2, node, tenv)\r
+               local count = worldedit.highlight(pos1, pos2, node)\r
                worldedit.player_notify(name, count .. " nodes highlighted")\r
        end,\r
 })\r
@@ -965,11 +897,7 @@ minetest.register_chatcommand("/restore", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.restore(pos1, pos2, tenv)\r
+               local count = worldedit.restore(pos1, pos2)\r
                worldedit.player_notify(name, count .. " nodes restored")\r
        end,\r
 })\r
@@ -1089,11 +1017,7 @@ minetest.register_chatcommand("/load", {
                        return\r
                end\r
 \r
-               local tenv = minetest.env\r
-               if worldedit.ENABLE_QUEUE then\r
-                       tenv = worldedit.queue_aliasenv\r
-               end\r
-               local count = worldedit.deserialize(pos1, value, tenv)\r
+               local count = worldedit.deserialize(pos1, value)\r
 \r
                worldedit.player_notify(name, count .. " nodes loaded")\r
        end,\r