Change all references of //dig to //fixlight, document the changes, fix a small typo.

This commit is contained in:
Anthony Zhang 2013-01-12 16:02:23 -05:00
parent 6fb039fb9d
commit 7cb2df24b8
4 changed files with 12 additions and 13 deletions

View File

@ -162,9 +162,9 @@ Rotate the current WorldEdit positions and region along the x/y/z/? axis by angl
//rotate z 270 //rotate z 270
//rotate ? -90 //rotate ? -90
### //dig ### //fixlight
Dig the current WorldEdit region. Fixes the lighting in the current WorldEdit region.
//dig //dig

View File

@ -56,11 +56,11 @@ Rotates a region defined by the positions `pos1` and `pos2` by `angle` degrees c
Returns the number of nodes rotated, the new position 1, and the new position 2. Returns the number of nodes rotated, the new position 1, and the new position 2.
### count = worldedit.dig(pos1, pos2) ### count = worldedit.fixlight(pos1, pos2)
Digs a region defined by positions `pos1` and `pos2`. Fixes the lighting in a region defined by positions `pos1` and `pos2`.
Returns the number of nodes dug. Returns the number of nodes updated.
Primitives Primitives
---------- ----------

View File

@ -304,11 +304,11 @@ worldedit.rotate = function(pos1, pos2, axis, angle)
return count, pos1, pos2 return count, pos1, pos2
end end
--Fixes the Lightning in a region defined by positions `pos1` and `pos2`, returning the number of nodes dug --fixes the lighting in a region defined by positions `pos1` and `pos2`, returning the number of nodes updated
worldedit.fixlight = 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 count = 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
@ -316,10 +316,9 @@ worldedit.fixlight = function(pos1, pos2)
while pos.y <= pos2.y do while pos.y <= pos2.y do
pos.z = pos1.z pos.z = pos1.z
while pos.z <= pos2.z do while pos.z <= pos2.z do
local node = env:get_node(pos) if env:get_node(pos).name == "air" then
if node.name == "air" then
env:dig_node(pos) env:dig_node(pos)
d = d + 1 count = count + 1
end end
pos.z = pos.z + 1 pos.z = pos.z + 1
end end
@ -327,5 +326,5 @@ worldedit.fixlight = function(pos1, pos2)
end end
pos.x = pos.x + 1 pos.x = pos.x + 1
end end
return d return count
end end

View File

@ -546,7 +546,7 @@ minetest.register_chatcommand("/rotate", {
minetest.register_chatcommand("/fixlight", { minetest.register_chatcommand("/fixlight", {
params = "", params = "",
description = "Fix the Lightning in the current WorldEdit region", description = "Fix the lighting 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]
@ -556,7 +556,7 @@ minetest.register_chatcommand("/fixlight", {
end end
local count = worldedit.fixlight(pos1, pos2) local count = worldedit.fixlight(pos1, pos2)
minetest.chat_send_player(name, count .. " nodes dug") minetest.chat_send_player(name, count .. " nodes updated")
end, end,
}) })