mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-26 02:30:40 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4f0ffe731f
@ -5,6 +5,7 @@ worldedit.hollow_sphere = function(pos, radius, nodename) --wip: use bresenham s
|
|||||||
local node = {name=nodename}
|
local node = {name=nodename}
|
||||||
local pos1 = {x=0, y=0, z=0}
|
local pos1 = {x=0, y=0, z=0}
|
||||||
local full_radius = radius * radius + radius
|
local full_radius = radius * radius + radius
|
||||||
|
local count = 0
|
||||||
local env = minetest.env
|
local env = minetest.env
|
||||||
for x = -radius, radius do
|
for x = -radius, radius do
|
||||||
pos1.x = pos.x + x
|
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
|
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
|
pos1.z = pos.z + z
|
||||||
env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z}, node)
|
env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z}, node)
|
||||||
|
count = count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
--adds a sphere at `pos` with radius `radius`, composed of `nodename`, returning the number of nodes added
|
--adds a sphere at `pos` with radius `radius`, composed of `nodename`, returning the number of nodes added
|
||||||
|
Loading…
Reference in New Issue
Block a user