]> git.lizzy.rs Git - worldedit.git/blobdiff - worldedit/primitives.lua
Update API docs
[worldedit.git] / worldedit / primitives.lua
index 1b1b6853039fb073de0592e9641c8f42738c5bef..0a7d1756f83d900ac2db8ef3807e99ac6ce79373 100644 (file)
@@ -171,7 +171,7 @@ function worldedit.cylinder(pos, axis, length, radius1, radius2, node_name, holl
        local count = 0\r
        for i = 0, length - 1 do\r
                -- Calulate radius for this "height" in the cylinder\r
-               local radius = radius1 + (radius2 - radius1) * i / (length - 1)\r
+               local radius = radius1 + (radius2 - radius1) * (i + 1) / length\r
                radius = math.floor(radius + 0.5) -- round\r
                local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1)\r
 \r
@@ -208,12 +208,13 @@ function worldedit.pyramid(pos, axis, height, node_name, hollow)
        local other1, other2 = worldedit.get_axis_others(axis)\r
 \r
        -- Set up voxel manipulator\r
-       local manip, area = mh.init_axis_radius(pos, axis,\r
-                       height >= 0 and height or -height)\r
+       -- FIXME: passing negative <radius> causes mis-sorted pos to be passed\r
+       -- into mh.init() which is technically not allowed but works\r
+       local manip, area = mh.init_axis_radius(pos, axis, height)\r
        local data = mh.get_empty_data(area)\r
 \r
        -- Handle inverted pyramids\r
-       local start_axis, end_axis, step\r
+       local step\r
        if height > 0 then\r
                height = height - 1\r
                step = 1\r