summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2012-10-18 21:28:45 -0400
committerAnthony Zhang <azhang9@gmail.com>2012-10-18 21:28:45 -0400
commit4f0ffe731ffd2e79ae6dfacf5c3310a1ac79f9b4 (patch)
tree4f7e2e3776680ee389d9d3c3f56dc9be5d5e2ae8
parente9cdf616ec3182636a02f972b2932a336fbe1916 (diff)
parent5585b7d24298f8e8d342f74cbb66cdfaa148280b (diff)
Merge remote-tracking branch 'origin/master'
-rw-r--r--worldedit/primitives.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/worldedit/primitives.lua b/worldedit/primitives.lua
index 2685d2b..37e2298 100644
--- a/worldedit/primitives.lua
+++ b/worldedit/primitives.lua
@@ -5,6 +5,7 @@ worldedit.hollow_sphere = function(pos, radius, nodename) --wip: use bresenham s
local node = {name=nodename}
local pos1 = {x=0, y=0, z=0}
local full_radius = radius * radius + radius
+ local count = 0
local env = minetest.env
for x = -radius, radius do
pos1.x = pos.x + x
@@ -14,10 +15,12 @@ worldedit.hollow_sphere = function(pos, radius, nodename) --wip: use bresenham s
if x*x+y*y+z*z >= (radius-1) * (radius-1) + (radius-1) and x*x+y*y+z*z <= full_radius then
pos1.z = pos.z + z
env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z}, node)
+ count = count + 1
end
end
end
end
+ return count
end
--adds a sphere at `pos` with radius `radius`, composed of `nodename`, returning the number of nodes added