1
0
Fork 0

Add more node sounds for ocean plants

objects
Wuzzy 2019-12-17 21:43:30 +01:00
parent b81396c03f
commit 5c953b1dc0
2 changed files with 21 additions and 1 deletions

View File

@ -56,6 +56,10 @@ local function coral_on_place(itemstack, placer, pointed_thing)
node_under.param2 = node_under.param2 + 8 node_under.param2 = node_under.param2 + 8
end end
minetest.set_node(pos_under, node_under) minetest.set_node(pos_under, node_under)
local def_node = minetest.registered_nodes[node_under.name]
if def_node.sounds then
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under })
end
if not (minetest.settings:get_bool("creative_mode")) then if not (minetest.settings:get_bool("creative_mode")) then
itemstack:take_item() itemstack:take_item()
end end

View File

@ -48,10 +48,17 @@ local function seagrass_on_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end end
-- Select a seagrass node
if node_under.name == "mcl_core:dirt" then if node_under.name == "mcl_core:dirt" then
node_under.name = "mcl_ocean:seagrass_dirt" node_under.name = "mcl_ocean:seagrass_dirt"
elseif node_under.name == "mcl_core:clay" then elseif node_under.name == "mcl_core:clay" then
node_under.name = "mcl_ocean:seagrass_clay" node_under.name = "mcl_ocean:seagrass_clay"
elseif node_under.name == "mcl_core:sand" then
node_under.name = "mcl_ocean:seagrass_sand"
elseif node_under.name == "mcl_core:redsand" then
node_under.name = "mcl_ocean:seagrass_redsand"
elseif node_under.name == "mcl_core:gravel" then
node_under.name = "mcl_ocean:seagrass_gravel"
else else
return itemstack return itemstack
end end
@ -60,6 +67,10 @@ local function seagrass_on_place(itemstack, placer, pointed_thing)
-- Random horizontal displacement -- Random horizontal displacement
node_under.param2 = node_under.param2 + 8 node_under.param2 = node_under.param2 + 8
end end
local def_node = minetest.registered_items[node_under.name]
if def_node.sounds then
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under })
end
minetest.set_node(pos_under, node_under) minetest.set_node(pos_under, node_under)
if not (minetest.settings:get_bool("creative_mode")) then if not (minetest.settings:get_bool("creative_mode")) then
itemstack:take_item() itemstack:take_item()
@ -83,6 +94,11 @@ for s=1, #surfaces do
if surfaces[s][3] == 1 then if surfaces[s][3] == 1 then
alt = surfaces[s][2] alt = surfaces[s][2]
end end
local sounds = table.copy(def.sounds)
local leaf_sounds = mcl_sounds.node_sound_leaves_defaults()
sounds.dig = leaf_sounds.dig
sounds.dug = leaf_sounds.dug
sounds.place = leaf_sounds.place
minetest.register_node("mcl_ocean:seagrass_"..surfaces[s][1], { minetest.register_node("mcl_ocean:seagrass_"..surfaces[s][1], {
drawtype = "plantlike_rooted", drawtype = "plantlike_rooted",
paramtype = "light", paramtype = "light",
@ -105,7 +121,7 @@ for s=1, #surfaces do
}, },
}, },
groups = { dig_immediate = 3, deco_block = 1, plant = 1, seagrass = 1, falling_node = surfaces[s][3] }, groups = { dig_immediate = 3, deco_block = 1, plant = 1, seagrass = 1, falling_node = surfaces[s][3] },
sounds = mcl_sounds.node_sound_leaves_defaults({footstep = mcl_sounds.node_sound_dirt_defaults().footstep}), sounds = sounds,
node_dig_prediction = surfaces[s][2], node_dig_prediction = surfaces[s][2],
after_dig_node = function(pos) after_dig_node = function(pos)
minetest.set_node(pos, {name=surfaces[s][2]}) minetest.set_node(pos, {name=surfaces[s][2]})