mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 08:20:21 +01:00
introduce nodebox abstractions used by fences, like corner nodeboxes, and indirectly slab_x; update fences accordingly
This commit is contained in:
parent
7d087815c8
commit
91092d99be
@ -71,14 +71,8 @@ homedecor.register("fence_picket", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.slab_z(-0.1),
|
||||||
type = "fixed",
|
node_box = homedecor.nodebox.slab_z(-0.002),
|
||||||
fixed = { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
|
|
||||||
},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
homedecor.register("fence_picket_corner", {
|
homedecor.register("fence_picket_corner", {
|
||||||
@ -93,20 +87,8 @@ homedecor.register("fence_picket_corner", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.corner_xz(0.1, -0.1),
|
||||||
type = "fixed",
|
node_box = homedecor.nodebox.corner_xz(0.002, -0.002),
|
||||||
fixed = {
|
|
||||||
{ -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.5, -0.5, -0.5, -0.4, 0.5, 0.4 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -0.5, -0.5, 0.498, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.5, -0.5, -0.5, -0.498, 0.5, 0.5 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
homedecor.register("fence_picket_white", {
|
homedecor.register("fence_picket_white", {
|
||||||
@ -121,14 +103,8 @@ homedecor.register("fence_picket_white", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.slab_z(-0.1),
|
||||||
type = "fixed",
|
node_box = homedecor.nodebox.slab_z(-0.002),
|
||||||
fixed = { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
|
|
||||||
},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
homedecor.register("fence_picket_corner_white", {
|
homedecor.register("fence_picket_corner_white", {
|
||||||
@ -143,20 +119,8 @@ homedecor.register("fence_picket_corner_white", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.corner_xz(0.1, -0.1),
|
||||||
type = "fixed",
|
node_box = homedecor.nodebox.corner_xz(0.002, -0.002),
|
||||||
fixed = {
|
|
||||||
{ -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.5, -0.5, -0.5, -0.4, 0.5, 0.4 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -0.5, -0.5, 0.498, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.5, -0.5, -0.5, -0.498, 0.5, 0.5 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
homedecor.register("fence_privacy", {
|
homedecor.register("fence_privacy", {
|
||||||
@ -171,10 +135,7 @@ homedecor.register("fence_privacy", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.slab_z(-3/16),
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, 5/16, 0.5, 0.5, 8/16 }
|
|
||||||
},
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -201,7 +162,7 @@ homedecor.register("fence_privacy_corner", {
|
|||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{ -0.5, -0.5, 5/16, 0.5, 0.5, 0.5 },
|
homedecor.box.slab_z(-3/16),
|
||||||
{ -0.5, -0.5, -0.5, -5/16, 0.5, 5/16 },
|
{ -0.5, -0.5, -0.5, -5/16, 0.5, 5/16 },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -226,10 +187,7 @@ homedecor.register("fence_barbed_wire", {
|
|||||||
tiles = {"homedecor_fence_barbed_wire.png"},
|
tiles = {"homedecor_fence_barbed_wire.png"},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.slab_z(-0.125),
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 }
|
|
||||||
},
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -247,13 +205,7 @@ homedecor.register("fence_barbed_wire_corner", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.corner_xz(0.125, -0.125),
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.5, -0.5, -0.5, -0.375, 0.5, 0.375 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -279,10 +231,7 @@ homedecor.register("fence_chainlink", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.slab_z(-0.125),
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 }
|
|
||||||
},
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -307,13 +256,7 @@ homedecor.register("fence_chainlink_corner", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.corner_xz(0.125, -0.125),
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.5, -0.5, -0.5, -0.375, 0.5, 0.375 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -342,10 +285,7 @@ homedecor.register("fence_wrought_iron_2", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.slab_z(-0.08),
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, 0.42, 0.5, 0.5, 0.5 }
|
|
||||||
},
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -372,13 +312,7 @@ homedecor.register("fence_wrought_iron_2_corner", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
selection_box = {
|
selection_box = homedecor.nodebox.corner_xz(0.08, -0.08),
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -0.5, -0.5, 0.42, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.5, -0.5, -0.5, -0.42, 0.5, 0.5 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
|
|
||||||
-- a box is defined as {x1, y1, z1, x2, y2, z2}
|
-- a box is defined as {x1, y1, z1, x2, y2, z2}
|
||||||
homedecor.box = {
|
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
|
-- 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_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)
|
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,
|
-- 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
|
-- but since conventionally a lot of nodes place slabs against +z for player convenience, we define
|
||||||
@ -28,6 +31,14 @@ homedecor.nodebox = {
|
|||||||
-- { type="regular" },
|
-- { type="regular" },
|
||||||
regular = { type="regular" },
|
regular = { type="regular" },
|
||||||
null = { type = "fixed", fixed = { 0, 0, 0, 0, 0, 0 } },
|
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 = {}
|
local mt = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user