Rename //dig to //fixlight

This commit is contained in:
sfan5 2013-01-12 08:10:19 +01:00
parent 89e18d6108
commit 5f1fb56b8b
2 changed files with 7 additions and 5 deletions

View File

@ -304,10 +304,11 @@ worldedit.rotate = function(pos1, pos2, axis, angle)
return count, pos1, pos2 return count, pos1, pos2
end end
--digs a region defined by positions `pos1` and `pos2`, returning the number of nodes dug --Fixes the Lightning in a region defined by positions `pos1` and `pos2`, returning the number of nodes dug
worldedit.dig = function(pos1, pos2) worldedit.fixlight = function(pos1, pos2)
local pos1, pos2 = worldedit.sort_pos(pos1, pos2) local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
local env = minetest.env local env = minetest.env
local d = 0
local pos = {x=pos1.x, y=0, z=0} local pos = {x=pos1.x, y=0, z=0}
while pos.x <= pos2.x do while pos.x <= pos2.x do
@ -318,11 +319,12 @@ worldedit.dig = function(pos1, pos2)
local node = env:get_node(pos) local node = env:get_node(pos)
if node.name == "air": if node.name == "air":
env:dig_node(pos) env:dig_node(pos)
d = d + 1
pos.z = pos.z + 1 pos.z = pos.z + 1
end end
pos.y = pos.y + 1 pos.y = pos.y + 1
end end
pos.x = pos.x + 1 pos.x = pos.x + 1
end end
return worldedit.volume(pos1, pos2) return d
end end

View File

@ -544,9 +544,9 @@ minetest.register_chatcommand("/rotate", {
end, end,
}) })
minetest.register_chatcommand("/dig", { minetest.register_chatcommand("/fixlight", {
params = "", params = "",
description = "Dig the current WorldEdit region", description = "Fix the Lightning in the current WorldEdit region",
privs = {worldedit=true}, privs = {worldedit=true},
func = function(name, param) func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]