forked from mtcontrib/homedecor_modpack
introduce nodebox abstractions used by fences, like corner nodeboxes, and indirectly slab_x; update fences accordingly
This commit is contained in:
@ -4,8 +4,11 @@
|
||||
|
||||
-- a box is defined as {x1, y1, z1, x2, y2, z2}
|
||||
homedecor.box = {
|
||||
-- slab starting from -x (after rotation: left)
|
||||
slab_x = function(depth) return { -0.5, -0.5, -0.5, -0.5+depth, 0.5, 0.5 } end,
|
||||
-- bottom slab (starting from -y) with height optionally shifted upwards
|
||||
slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end,
|
||||
-- slab starting from -z (+z with negative depth)
|
||||
slab_z = function(depth)
|
||||
-- for consistency with the other functions here, we have to assume that a "z" slab starts from -z and extends by depth,
|
||||
-- but since conventionally a lot of nodes place slabs against +z for player convenience, we define
|
||||
@ -28,6 +31,14 @@ homedecor.nodebox = {
|
||||
-- { type="regular" },
|
||||
regular = { type="regular" },
|
||||
null = { type = "fixed", fixed = { 0, 0, 0, 0, 0, 0 } },
|
||||
corner_xz = function(depth_x, depth_z) return {
|
||||
type="fixed",
|
||||
fixed={
|
||||
homedecor.box.slab_x(depth_x),
|
||||
homedecor.box.slab_z(depth_z),
|
||||
-- { -0.5, -0.5, -0.5, 0.5-depth, 0.5, -0.5+depth } -- slab_x without the overlap, but actually looks a bit worse
|
||||
}
|
||||
} end,
|
||||
}
|
||||
|
||||
local mt = {}
|
||||
|
Reference in New Issue
Block a user