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 ? -90
### //dig
### //fixlight
Dig the current WorldEdit region.
Fixes the lighting in the current WorldEdit region.
//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.
### 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
----------

View File

@ -304,11 +304,11 @@ worldedit.rotate = function(pos1, pos2, axis, angle)
return count, pos1, pos2
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)
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
local env = minetest.env
local d = 0
local count = 0
local pos = {x=pos1.x, y=0, z=0}
while pos.x <= pos2.x do
@ -316,10 +316,9 @@ worldedit.fixlight = function(pos1, pos2)
while pos.y <= pos2.y do
pos.z = pos1.z
while pos.z <= pos2.z do
local node = env:get_node(pos)
if node.name == "air" then
if env:get_node(pos).name == "air" then
env:dig_node(pos)
d = d + 1
count = count + 1
end
pos.z = pos.z + 1
end
@ -327,5 +326,5 @@ worldedit.fixlight = function(pos1, pos2)
end
pos.x = pos.x + 1
end
return d
return count
end

View File

@ -546,7 +546,7 @@ minetest.register_chatcommand("/rotate", {
minetest.register_chatcommand("/fixlight", {
params = "",
description = "Fix the Lightning in the current WorldEdit region",
description = "Fix the lighting in the current WorldEdit region",
privs = {worldedit=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
@ -556,7 +556,7 @@ minetest.register_chatcommand("/fixlight", {
end
local count = worldedit.fixlight(pos1, pos2)
minetest.chat_send_player(name, count .. " nodes dug")
minetest.chat_send_player(name, count .. " nodes updated")
end,
})