forked from nalc/homedecor_modpack
fix slab_z nodebox direction inconsistencies
This commit is contained in:
parent
7d07e81a8c
commit
7d087815c8
|
@ -80,7 +80,7 @@ homedecor.register("4_bottles_multi", {
|
||||||
selection_box = fbottle_cbox
|
selection_box = fbottle_cbox
|
||||||
})
|
})
|
||||||
|
|
||||||
local wine_cbox = homedecor.nodebox.slab_z(0.25)
|
local wine_cbox = homedecor.nodebox.slab_z(-0.75)
|
||||||
homedecor.register("wine_rack", {
|
homedecor.register("wine_rack", {
|
||||||
description = "Wine Rack",
|
description = "Wine Rack",
|
||||||
mesh = "homedecor_wine_rack.obj",
|
mesh = "homedecor_wine_rack.obj",
|
||||||
|
|
|
@ -4,8 +4,20 @@
|
||||||
|
|
||||||
-- 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 = {
|
||||||
|
-- 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_z = function(depth) return { -0.5, -0.5, -0.5+depth, 0.5, 0.5, 0.5 } end,
|
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
|
||||||
|
-- a "negative" depth as a depth extending from the other side, i.e. +z
|
||||||
|
if depth > 0 then
|
||||||
|
-- slab starting from -z
|
||||||
|
return { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5+depth }
|
||||||
|
else
|
||||||
|
-- slab starting from +z (z1=0.5-(-depth))
|
||||||
|
return { -0.5, -0.5, 0.5+depth, 0.5, 0.5, 0.5 }
|
||||||
|
end
|
||||||
|
end,
|
||||||
bar_y = function(radius) return {-radius, -0.5, -radius, radius, 0.5, radius} end,
|
bar_y = function(radius) return {-radius, -0.5, -radius, radius, 0.5, radius} end,
|
||||||
cuboid = function(radius_x, radius_y, radius_z) return {-radius_x, -radius_y, -radius_z, radius_x, radius_y, radius_z} end,
|
cuboid = function(radius_x, radius_y, radius_z) return {-radius_x, -radius_y, -radius_z, radius_x, radius_y, radius_z} end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ homedecor.register("dvd_cd_cabinet", {
|
||||||
"homedecor_dvdcd_cabinet_front.png",
|
"homedecor_dvdcd_cabinet_front.png",
|
||||||
"homedecor_dvdcd_cabinet_back.png"
|
"homedecor_dvdcd_cabinet_back.png"
|
||||||
},
|
},
|
||||||
selection_box = homedecor.nodebox.slab_z(0.5),
|
selection_box = homedecor.nodebox.slab_z(-0.5),
|
||||||
groups = {choppy=2,oddly_breakable_by_hand=2},
|
groups = {choppy=2,oddly_breakable_by_hand=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user