summaryrefslogtreecommitdiff
path: root/worldedit_commands
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2012-12-12 17:17:56 -0500
committerAnthony Zhang <azhang9@gmail.com>2012-12-12 17:17:56 -0500
commite5331d39ae35b945017b5a4229dd089c196df95b (patch)
treef64922e7202321e4b4ccd24e33b2f2c0f3e0d297 /worldedit_commands
parentf087c3ef715f560ab8e716d5a92cf7b894916b0f (diff)
Many thanks to Smitje for providing a working example of roations.
Changes: fixed rotation and transposition of non-sqaure regions, makers are now moved to the new region boundaries after rotation/transposition, small consistency fixes, finally fix the /hide command.
Diffstat (limited to 'worldedit_commands')
-rw-r--r--worldedit_commands/init.lua46
1 files changed, 38 insertions, 8 deletions
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua
index ad6dac8..4529470 100644
--- a/worldedit_commands/init.lua
+++ b/worldedit_commands/init.lua
@@ -115,17 +115,17 @@ minetest.register_on_punchnode(function(pos, node, puncher)
worldedit.pos1[name] = pos
worldedit.mark_pos1(name)
worldedit.set_pos[name] = "pos2" --set position 2 on the next invocation
- minetest.chat_send_player(name, "WorldEdit region position 1 set to " .. minetest.pos_to_string(pos))
+ minetest.chat_send_player(name, "WorldEdit position 1 set to " .. minetest.pos_to_string(pos))
elseif worldedit.set_pos[name] == "pos1only" then --setting position 1 only
worldedit.pos1[name] = pos
worldedit.mark_pos1(name)
worldedit.set_pos[name] = nil --finished setting positions
- minetest.chat_send_player(name, "WorldEdit region position 1 set to " .. minetest.pos_to_string(pos))
+ minetest.chat_send_player(name, "WorldEdit position 1 set to " .. minetest.pos_to_string(pos))
elseif worldedit.set_pos[name] == "pos2" then --setting position 2
worldedit.pos2[name] = pos
worldedit.mark_pos2(name)
worldedit.set_pos[name] = nil --finished setting positions
- minetest.chat_send_player(name, "WorldEdit region position 2 set to " .. minetest.pos_to_string(pos))
+ minetest.chat_send_player(name, "WorldEdit position 2 set to " .. minetest.pos_to_string(pos))
end
end
end)
@@ -472,7 +472,14 @@ minetest.register_chatcommand("/transpose", {
return
end
- local count = worldedit.transpose(pos1, pos2, axis1, axis2)
+ local count, pos1, pos2 = worldedit.transpose(pos1, pos2, axis1, axis2)
+
+ --reset markers to transposed positions
+ worldedit.pos1[name] = pos1
+ worldedit.pos2[name] = pos2
+ worldedit.mark_pos1(name)
+ worldedit.mark_pos2(name)
+
minetest.chat_send_player(name, count .. " nodes transposed")
end,
})
@@ -525,7 +532,14 @@ minetest.register_chatcommand("/rotate", {
return
end
- local count = worldedit.rotate(pos1, pos2, axis, angle)
+ local count, pos1, pos2 = worldedit.rotate(pos1, pos2, axis, angle)
+
+ --reset markers to rotated positions
+ worldedit.pos1[name] = pos1
+ worldedit.pos2[name] = pos2
+ worldedit.mark_pos1(name)
+ worldedit.mark_pos2(name)
+
minetest.chat_send_player(name, count .. " nodes rotated")
end,
})
@@ -547,8 +561,24 @@ minetest.register_chatcommand("/dig", {
})
minetest.register_chatcommand("/hide", {
+ params = "",
+ description = "Hide all nodes in the current WorldEdit region non-destructively",
+ privs = {worldedit=true},
+ func = function(name, param)
+ local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
+ if pos1 == nil or pos2 == nil then
+ minetest.chat_send_player(name, "No WorldEdit region selected")
+ return
+ end
+
+ local count = worldedit.hide(pos1, pos2)
+ minetest.chat_send_player(name, count .. " nodes hidden")
+ end,
+})
+
+minetest.register_chatcommand("/suppress", {
params = "<node>",
- description = "Hide all <node> in the current WorldEdit region non-destructively",
+ description = "Suppress all <node> in the current WorldEdit region non-destructively",
privs = {worldedit=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
@@ -562,8 +592,8 @@ minetest.register_chatcommand("/hide", {
return
end
- local count = worldedit.hide(pos1, pos2, param)
- minetest.chat_send_player(name, count .. " nodes hidden")
+ local count = worldedit.suppress(pos1, pos2, param)
+ minetest.chat_send_player(name, count .. " nodes suppressed")
end,
})