summaryrefslogtreecommitdiff
path: root/worldedit
diff options
context:
space:
mode:
authorSebastien Ponce <Sebastien.Ponce@cern.ch>2015-09-13 11:31:47 +0200
committerSebastien Ponce <Sebastien.Ponce@cern.ch>2015-09-13 22:08:04 +0200
commit5f9efb1205fe9802f859548fc9220f98dd0fd12e (patch)
tree39d5bd7cf4cb71b2f7eac71465199d881f797d68 /worldedit
parentfc037e9c82f34a6bf441dd738c1b10a510eb8b4d (diff)
Added hollow pyramids
Diffstat (limited to 'worldedit')
-rw-r--r--worldedit/primitives.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/worldedit/primitives.lua b/worldedit/primitives.lua
index 6d3b026..edb7db6 100644
--- a/worldedit/primitives.lua
+++ b/worldedit/primitives.lua
@@ -150,8 +150,9 @@ end
-- @param axis Axis ("x", "y", or "z")
-- @param height Pyramid height.
-- @param node_name Name of node to make pyramid of.
+-- @param hollow Whether the pyramid should be hollow.
-- @return The number of nodes added.
-function worldedit.pyramid(pos, axis, height, node_name)
+function worldedit.pyramid(pos, axis, height, node_name, hollow)
local other1, other2 = worldedit.get_axis_others(axis)
-- Set up voxel manipulator
@@ -187,10 +188,12 @@ function worldedit.pyramid(pos, axis, height, node_name)
local new_index2 = new_index1 + (index2 + offset[other1]) * stride[other1]
for index3 = -size, size do
local i = new_index2 + (index3 + offset[other2]) * stride[other2]
- data[i] = node_id
+ if (not hollow or size - math.abs(index2) < 2 or size - math.abs(index3) < 2) then
+ data[i] = node_id
+ count = count + 1
+ end
end
end
- count = count + (size * 2 + 1) ^ 2
size = size - 1
end