mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-07-12 21:00:25 +02:00
dual-based cylinder
This commit is contained in:
@ -104,8 +104,8 @@ worldedit.hollow_cylinder = function(pos, axis, length, radius, nodename)
|
||||
return count
|
||||
end
|
||||
|
||||
--adds a cylinder at `pos` along the `axis` axis ("x" or "y" or "z") with length `length` and radius `radius`, composed of `nodename`, returning the number of nodes added
|
||||
worldedit.cylinder = function(pos, axis, length, radius, nodename)
|
||||
--adds a cylinder at `pos` along the `axis` axis ("x" or "y" or "z") with length `length`, base radius `radius` (and top radius `radius`), composed of `nodename`, returning the number of nodes added
|
||||
worldedit.cylinder = function(pos, axis, length, radius1, radius2, nodename)
|
||||
local other1, other2
|
||||
if axis == "x" then
|
||||
other1, other2 = "y", "z"
|
||||
@ -125,6 +125,9 @@ worldedit.cylinder = function(pos, axis, length, radius, nodename)
|
||||
step = -1
|
||||
end
|
||||
for i = 1, length do
|
||||
local radius = radius1 + (radius2 - radius1) * (i - 1) / (length - 1)
|
||||
--radius shouldn't need rounding
|
||||
radius = math.floor(radius+0.5)
|
||||
local offset1, offset2 = 0, radius
|
||||
local delta = -radius
|
||||
while offset1 <= offset2 do
|
||||
@ -256,4 +259,4 @@ worldedit.spiral = function(pos, width, height, spacer, nodename) --wip: clean t
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user