summaryrefslogtreecommitdiff
path: root/worldedit_commands
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2017-09-05 14:40:46 +0200
committersfan5 <sfan5@live.de>2017-09-05 14:40:46 +0200
commit3c61759bae15d8bedc9c54b4e3903479a5f4cf08 (patch)
tree39927d87549c4ba02801e8f2e18576c4c8852edb /worldedit_commands
parent2f4eb19a3afa73b95fd5ce50011c3292dec8bbc2 (diff)
Allow to bulk-set param2 of regions (#144)
Diffstat (limited to 'worldedit_commands')
-rw-r--r--worldedit_commands/init.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua
index 897636c..1ab8c19 100644
--- a/worldedit_commands/init.lua
+++ b/worldedit_commands/init.lua
@@ -408,6 +408,25 @@ minetest.register_chatcommand("/set", {
end, check_region),
})
+minetest.register_chatcommand("/param2", {
+ params = "<param2>",
+ description = "Set param2 of all nodes in the current WorldEdit region to <param2>",
+ privs = {worldedit=true},
+ func = safe_region(function(name, param)
+ local param2 = tonumber(param)
+ if not param2 then
+ worldedit.player_notify(name, "Invalid or missing param2 argument")
+ return
+ elseif param2 < 0 or param2 > 255 then
+ worldedit.player_notify(name, "Param2 is out of range (must be between 0 and 255 inclusive)!")
+ return
+ end
+
+ local count = worldedit.set_param2(worldedit.pos1[name], worldedit.pos2[name], param2)
+ worldedit.player_notify(name, count .. " nodes altered")
+ end, check_region),
+})
+
minetest.register_chatcommand("/mix", {
params = "<node1> ...",
description = "Fill the current WorldEdit region with a random mix of <node1>, ...",