//rotate z 270\r
//rotate ? -90\r
\r
-### //dig\r
+### //fixlight\r
\r
-Dig the current WorldEdit region.\r
+Fixes the lighting in the current WorldEdit region.\r
\r
//dig\r
\r
\r
Returns the number of nodes rotated, the new position 1, and the new position 2.\r
\r
-### count = worldedit.dig(pos1, pos2)\r
+### count = worldedit.fixlight(pos1, pos2)\r
\r
-Digs a region defined by positions `pos1` and `pos2`.\r
+Fixes the lighting in a region defined by positions `pos1` and `pos2`.\r
\r
-Returns the number of nodes dug.\r
+Returns the number of nodes updated.\r
\r
Primitives\r
----------\r
return count, pos1, pos2\r
end\r
\r
---Fixes the Lightning in a region defined by positions `pos1` and `pos2`, returning the number of nodes dug\r
+--fixes the lighting in a region defined by positions `pos1` and `pos2`, returning the number of nodes updated\r
worldedit.fixlight = function(pos1, pos2)\r
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)\r
local env = minetest.env\r
- local d = 0\r
+ local count = 0\r
\r
local pos = {x=pos1.x, y=0, z=0}\r
while pos.x <= pos2.x do\r
while pos.y <= pos2.y do\r
pos.z = pos1.z\r
while pos.z <= pos2.z do\r
- local node = env:get_node(pos)\r
- if node.name == "air" then\r
+ if env:get_node(pos).name == "air" then\r
env:dig_node(pos)\r
- d = d + 1\r
+ count = count + 1\r
end\r
pos.z = pos.z + 1\r
end\r
end\r
pos.x = pos.x + 1\r
end\r
- return d\r
+ return count\r
end
\r
minetest.register_chatcommand("/fixlight", {\r
params = "",\r
- description = "Fix the Lightning in the current WorldEdit region",\r
+ description = "Fix the lighting in the current WorldEdit region",\r
privs = {worldedit=true},\r
func = function(name, param)\r
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]\r
end\r
\r
local count = worldedit.fixlight(pos1, pos2)\r
- minetest.chat_send_player(name, count .. " nodes dug")\r
+ minetest.chat_send_player(name, count .. " nodes updated")\r
end,\r
})\r
\r