summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-02-08 01:38:05 +0100
committerest31 <MTest31@outlook.com>2015-02-20 22:30:34 +0100
commitbea38a116a441940c0be71fee42405f7b15c784a (patch)
tree04ab1996067149ebd2d42aef3858424335ce42e8
parent4336e7ca1467599feb08c1f9ad0aaa145c080ca8 (diff)
Add //deleteblocks command
-rw-r--r--ChatCommands.md6
-rw-r--r--worldedit_commands/init.lua15
2 files changed, 21 insertions, 0 deletions
diff --git a/ChatCommands.md b/ChatCommands.md
index 07bcfd6..0c8b3a1 100644
--- a/ChatCommands.md
+++ b/ChatCommands.md
@@ -98,6 +98,12 @@ Display the volume of the current WorldEdit region.
//volume
+### `//deleteblocks`
+
+Delete the MapBlocks (16x16x16 units) that contain the selected region. This means that mapgen will be invoked for that area. As only whole MapBlocks get removed, the deleted area is usually larger than the selected one. Also, mapgen can trigger mechanisms like mud reflow or cavegen, which affects nodes (up to 112 nodes away) outside the MapBlock, so dont use this near buildings.
+
+ //deleteblocks
+
### `//set <node>`
Set the current WorldEdit region to `<node>`.
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua
index 424082f..e97f304 100644
--- a/worldedit_commands/init.lua
+++ b/worldedit_commands/init.lua
@@ -277,6 +277,21 @@ minetest.register_chatcommand("/volume", {
end,
})
+minetest.register_chatcommand("/deleteblocks", {
+ params = "",
+ description = "remove all MapBlocks (16x16x16) containing the selected area from the map",
+ privs = {worldedit=true},
+ func = safe_region(function(name, param)
+ local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
+ local success = minetest.delete_area(pos1, pos2)
+ if success then
+ worldedit.player_notify(name, "Area deleted.")
+ else
+ worldedit.player_notify(name, "There was an error during deletion of the area.")
+ end
+ end),
+})
+
minetest.register_chatcommand("/set", {
params = "<node>",
description = "Set the current WorldEdit region to <node>",