forked from mtcontrib/Minetest-WorldEdit
Some minor clean ups
This commit is contained in:
@ -15,9 +15,9 @@ local mh = worldedit.manip_helpers
|
||||
function worldedit.cube(pos, width, height, length, node_name, hollow)
|
||||
-- Set up voxel manipulator
|
||||
local basepos = vector.subtract(pos,
|
||||
{x = math.floor(width / 2), y = 0, z = math.floor(length / 2)})
|
||||
vector.new(math.floor(width / 2), 0, math.floor(length / 2)))
|
||||
local endpos = vector.add(basepos,
|
||||
{x = width - 1, y = height - 1, z = length - 1})
|
||||
vector.new(width - 1, height - 1, length - 1))
|
||||
local manip, area = mh.init(basepos, endpos)
|
||||
local data = mh.get_empty_data(area)
|
||||
|
||||
@ -158,11 +158,7 @@ function worldedit.cylinder(pos, axis, length, radius1, radius2, node_name, holl
|
||||
-- Add desired shape (anything inbetween cylinder & cone)
|
||||
local node_id = minetest.get_content_id(node_name)
|
||||
local stride = vector.new(1, area.ystride, area.zstride)
|
||||
local offset = {
|
||||
x = current_pos.x - area.MinEdge.x,
|
||||
y = current_pos.y - area.MinEdge.y,
|
||||
z = current_pos.z - area.MinEdge.z,
|
||||
}
|
||||
local offset = vector.subtract(current_pos, area.MinEdge)
|
||||
local count = 0
|
||||
for i = 0, length - 1 do
|
||||
-- Calulate radius for this "height" in the cylinder
|
||||
@ -221,11 +217,7 @@ function worldedit.pyramid(pos, axis, height, node_name, hollow)
|
||||
-- Add pyramid
|
||||
local node_id = minetest.get_content_id(node_name)
|
||||
local stride = vector.new(1, area.ystride, area.zstride)
|
||||
local offset = {
|
||||
x = pos.x - area.MinEdge.x,
|
||||
y = pos.y - area.MinEdge.y,
|
||||
z = pos.z - area.MinEdge.z,
|
||||
}
|
||||
local offset = vector.subtract(pos, area.MinEdge)
|
||||
local size = math.abs(height * step)
|
||||
local count = 0
|
||||
-- For each level of the pyramid
|
||||
@ -267,8 +259,8 @@ function worldedit.spiral(pos, length, height, spacer, node_name)
|
||||
-- Set up variables
|
||||
local node_id = minetest.get_content_id(node_name)
|
||||
local stride = vector.new(1, area.ystride, area.zstride)
|
||||
local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z
|
||||
local i = offset_z * stride.z + offset_y * stride.y + offset_x + 1
|
||||
local offset = vector.subtract(pos, area.MinEdge)
|
||||
local i = offset.z * stride.z + offset.y * stride.y + offset.x + 1
|
||||
|
||||
-- Add first column
|
||||
local count = height
|
||||
|
Reference in New Issue
Block a user