forked from mtcontrib/Minetest-WorldEdit
Add //drain
This commit is contained in:
parent
b06e004d80
commit
61ab240cea
|
@ -291,6 +291,12 @@ Fixes the lighting in the current WorldEdit region.
|
|||
|
||||
//fixlight
|
||||
|
||||
### `//drain`
|
||||
|
||||
Removes any fluid node within the current WorldEdit region.
|
||||
|
||||
//drain
|
||||
|
||||
### `//hide`
|
||||
|
||||
Hide all nodes in the current WorldEdit region non-destructively.
|
||||
|
|
|
@ -838,6 +838,30 @@ minetest.register_chatcommand("/fixlight", {
|
|||
end),
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("/drain", {
|
||||
params = "",
|
||||
description = "Remove any fluid node within the current WorldEdit region",
|
||||
privs = {worldedit=true},
|
||||
func = safe_region(function(name, param)
|
||||
-- TODO: make an API function for this
|
||||
local count = 0
|
||||
local pos1, pos2 = worldedit.sort_pos(worldedit.pos1[name], worldedit.pos2[name])
|
||||
for x = pos1.x, pos2.x do
|
||||
for y = pos1.y, pos2.y do
|
||||
for z = pos1.z, pos2.z do
|
||||
local n = minetest.get_node({x=x, y=y, z=z}).name
|
||||
local d = minetest.registered_nodes[n]
|
||||
if d ~= nil and (d["drawtype"] == "liquid" or d["drawtype"] == "flowingliquid") then
|
||||
minetest.remove_node({x=x, y=y, z=z})
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
worldedit.player_notify(name, count .. " nodes updated")
|
||||
end),
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("/hide", {
|
||||
params = "",
|
||||
description = "Hide all nodes in the current WorldEdit region non-destructively",
|
||||
|
|
Loading…
Reference in New Issue
Block a user