give bathtub some rough collision info

allow showerhead to be turned on when placed 2m above the tub
(must be on the same end as the taps)
master^2
Vanessa Dannenberg 2019-05-25 00:59:51 -04:00
parent 9d64af85ca
commit a9cfef8fba
1 changed files with 29 additions and 9 deletions

View File

@ -347,7 +347,10 @@ homedecor.register("shower_head", {
on_rotate = screwdriver.disallow,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-2.0, z=pos.z})
if below and below.name == "homedecor:shower_tray" then
if below and (
below.name == "homedecor:shower_tray" or
below.name == "homedecor:bathtub_clawfoot_brass_taps" or
below.name == "homedecor:bathtub_clawfoot_chrome_taps" ) then
local particledef = {
outlet = { x = 0, y = -0.42, z = 0.1 },
velocity_x = { min = -0.15, max = 0.15 },
@ -364,6 +367,27 @@ homedecor.register("shower_head", {
end
})
local tub_sbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 1.5, 0.3125, 0.5 },
}
local tub_cbox = {
type = "fixed",
fixed = {
{-0.4375, -0.0625, -0.5, 1.4375, 0.5, -0.4375}, -- NodeBox1
{-0.4375, -0.0625, 0.4375, 1.4375, 0.5, 0.5}, -- NodeBox2
{-0.5, 0.1875, -0.4375, -0.4375, 0.5, 0.4375}, -- NodeBox3
{1.4375, -0.0625, -0.4375, 1.5, 0.5, 0.4375}, -- NodeBox4
{-0.3125, -0.3125, -0.4375, -0.125, -0.0625, 0.4375}, -- NodeBox5
{1.375, -0.3125, -0.4375, 1.4375, -0.0625, 0.4375}, -- NodeBox6
{-0.125, -0.3125, 0.375, 1.375, -0.0625, 0.4375}, -- NodeBox7
{-0.125, -0.3125, -0.4375, 1.375, -0.0625, -0.375}, -- NodeBox8
{-0.125, -0.5, -0.375, 1.375, -0.3125, 0.375}, -- NodeBox9
{-0.4375, -0.0625, -0.4375, -0.3125, 0.1875, 0.4375}, -- NodeBox10
}
}
homedecor.register("bathtub_clawfoot_brass_taps", {
drawtype = "mesh",
mesh = "homedecor_bathtub_clawfoot.obj",
@ -377,10 +401,8 @@ homedecor.register("bathtub_clawfoot_brass_taps", {
},
description = S("Bathtub, clawfoot, with brass taps"),
groups = {cracky=3},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 1.5, 0.3125, 0.5 },
},
selection_box = tub_sbox,
node_box = tub_cbox,
sounds = default.node_sound_stone_defaults(),
})
@ -397,10 +419,8 @@ homedecor.register("bathtub_clawfoot_chrome_taps", {
},
description = S("Bathtub, clawfoot, with chrome taps"),
groups = {cracky=3},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 1.5, 0.3125, 0.5 },
},
selection_box = tub_sbox,
node_box = tub_cbox,
sounds = default.node_sound_stone_defaults(),
})