1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-07-23 15:40:18 +02:00

make bathroom taps use the new particles code

also make shower tray turn off taps above it, if any
minor tweak to particles function to add Y velocity
added more detailed collision boxes to the sinks to accommodate particles
This commit is contained in:
Vanessa Ezekowitz
2015-05-10 22:08:34 -04:00
parent 12f5ac9d02
commit 9c9e525cd7
3 changed files with 58 additions and 7 deletions

View File

@ -95,13 +95,44 @@ homedecor.register("sink", {
},
inventory_image="homedecor_bathroom_sink_inv.png",
selection_box = sink_cbox,
collision_box = sink_cbox,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
node_box = {
type = "fixed",
fixed = {
{ -5/16, 5/16, 1/16, -4/16, 8/16, 8/16 },
{ 5/16, 5/16, 1/16, 4/16, 8/16, 8/16 },
{ -5/16, 5/16, 1/16, 5/16, 8/16, 2/16 },
{ -5/16, 5/16, 6/16, 5/16, 8/16, 8/16 },
{ -4/16, -8/16, 1/16, 4/16, 5/16, 6/16 }
}
},
on_destruct = function(pos)
homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z})
end
})
--Taps
local function taps_on_rightclick(pos, node, clicker)
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
if below and
string.find(below.name, "homedecor:shower_tray") or
string.find(below.name, "homedecor:sink") or
string.find(below.name, "homedecor:kitchen_cabinet_with_sink") then
local particledef = {
outlet_x = 0,
outlet_y = -0.44,
outlet_z = 0.28,
velocity_x = { min = -0.1, max = 0.1 },
velocity_y = -0.3,
velocity_z = { min = -0.1, max = 0 },
spread = 0
}
homedecor.start_particle_spawner(pos, node, particledef, "homedecor_shower")
end
end
homedecor.register("taps", {
description = S("Bathroom taps/faucet"),
mesh = "homedecor_bathroom_faucet.obj",
@ -120,6 +151,8 @@ homedecor.register("taps", {
walkable = false,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
on_rightclick = taps_on_rightclick,
on_destruct = homedecor.stop_particle_spawner
})
homedecor.register("taps_brass", {
@ -140,6 +173,8 @@ homedecor.register("taps_brass", {
walkable = false,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
on_rightclick = taps_on_rightclick,
on_destruct = homedecor.stop_particle_spawner
})
--Shower Tray
@ -167,8 +202,8 @@ homedecor.register("shower_tray", {
groups = {cracky=2},
sounds = default.node_sound_stone_defaults(),
on_destruct = function(pos)
headpos = {x=pos.x, y=pos.y+2, z=pos.z}
homedecor.stop_particle_spawner(headpos)
homedecor.stop_particle_spawner({x=pos.x, y=pos.y+2, z=pos.z}) -- the showerhead
homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z}) -- the taps, if any
end
})
@ -200,6 +235,7 @@ homedecor.register("shower_head", {
outlet_y = -0.42,
outlet_z = 0.1,
velocity_x = { min = -0.15, max = 0.15 },
velocity_y = -2,
velocity_z = { min = -0.3, max = 0.1 },
spread = 0.12
}