diff --git a/Chat Commands.md b/Chat Commands.md index 28db902..861f4ae 100644 --- a/Chat Commands.md +++ b/Chat Commands.md @@ -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 diff --git a/WorldEdit API.md b/WorldEdit API.md index c6f1ace..be2270d 100644 --- a/WorldEdit API.md +++ b/WorldEdit API.md @@ -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 ---------- diff --git a/worldedit/manipulations.lua b/worldedit/manipulations.lua index f5b70ee..1903084 100644 --- a/worldedit/manipulations.lua +++ b/worldedit/manipulations.lua @@ -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 diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 756ebc4..b0e15b3 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -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, })