1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-07-20 14:20:22 +02:00

introduce nodebox abstractions used by fences, like corner nodeboxes, and indirectly slab_x; update fences accordingly

This commit is contained in:
Tim
2015-08-19 15:32:19 +02:00
parent 7d087815c8
commit 91092d99be
2 changed files with 27 additions and 82 deletions

View File

@ -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 = {}