diff --git a/homedecor/gastronomy.lua b/homedecor/gastronomy.lua index f1b6e5d..3cbf2db 100644 --- a/homedecor/gastronomy.lua +++ b/homedecor/gastronomy.lua @@ -80,7 +80,7 @@ homedecor.register("4_bottles_multi", { 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", { description = "Wine Rack", mesh = "homedecor_wine_rack.obj", diff --git a/homedecor/handlers/nodeboxes.lua b/homedecor/handlers/nodeboxes.lua index 11a04fe..a5aec30 100644 --- a/homedecor/handlers/nodeboxes.lua +++ b/homedecor/handlers/nodeboxes.lua @@ -4,8 +4,20 @@ -- a box is defined as {x1, y1, z1, x2, y2, z2} 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_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, cuboid = function(radius_x, radius_y, radius_z) return {-radius_x, -radius_y, -radius_z, radius_x, radius_y, radius_z} end, } diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index adc934e..1cab08d 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -249,7 +249,7 @@ homedecor.register("dvd_cd_cabinet", { "homedecor_dvdcd_cabinet_front.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}, sounds = default.node_sound_wood_defaults(), })