Add water bucket sounds from Voxelands

This commit is contained in:
Wuzzy 2017-06-06 21:50:03 +02:00
parent 5e614b4436
commit 02e23893f5
5 changed files with 31 additions and 2 deletions

View File

@ -69,4 +69,9 @@ blukotek (CC0 1.0)
https://www.freesound.org/people/blukotek/sounds/251660/ https://www.freesound.org/people/blukotek/sounds/251660/
default_dig_snappy.ogg default_dig_snappy.ogg
Voxelands project <http://www.voxelands.com/> (CC BY-SA 3.0)
mcl_sounds_place_node_water.ogg
mcl_sounds_dug_water.ogg
(Note: Artists from the Voxelands project include: sdzen, darkrose, sapier,
Tom Peter, Telaron, juskiddink)

View File

@ -127,6 +127,10 @@ function mcl_sounds.node_sound_water_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_water_footstep", gain = 0.2} {name = "default_water_footstep", gain = 0.2}
table.place = table.place or
{name = "mcl_sounds_place_node_water", gain = 1.0}
table.dug = table.dug or
{name = "mcl_sounds_dug_water", gain = 1.0}
mcl_sounds.node_sound_defaults(table) mcl_sounds.node_sound_defaults(table)
return table return table
end end

Binary file not shown.

View File

@ -18,6 +18,21 @@ minetest.register_craft({
bucket = {} bucket = {}
bucket.liquids = {} bucket.liquids = {}
-- Sound helper functions for placing and taking liquids
local sound_place = function(itemname, pos)
local def = minetest.registered_nodes[itemname]
if def and def.sounds and def.sounds.place then
minetest.sound_play(def.sounds.place, {gain=1.0, pos = pos})
end
end
local sound_take = function(itemname, pos)
local def = minetest.registered_nodes[itemname]
if def and def.sounds and def.sounds.dug then
minetest.sound_play(def.sounds.dug, {gain=1.0, pos = pos})
end
end
-- Register a new liquid -- Register a new liquid
-- source = name of the source node -- source = name of the source node
-- flowing = name of the flowing node -- flowing = name of the flowing node
@ -56,6 +71,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
end end
local place_liquid = function(pos, node, source, flowing, fullness) local place_liquid = function(pos, node, source, flowing, fullness)
sound_place(source, pos)
if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then
minetest.add_node(pos, {name=source, param2=fullness}) minetest.add_node(pos, {name=source, param2=fullness})
return return
@ -83,8 +99,10 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
nn == "mcl_cauldrons:cauldron_2") then nn == "mcl_cauldrons:cauldron_2") then
-- Put water into cauldron -- Put water into cauldron
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_3"}) minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_3"})
sound_place("mcl_core:water_source", pos)
elseif item == "bucket:bucket_water" and nn == "mcl_cauldrons:cauldron_3" then elseif item == "bucket:bucket_water" and nn == "mcl_cauldrons:cauldron_3" then
-- No-op (just empty the bucket) sound_place("mcl_core:water_source", pos)
elseif minetest.registered_nodes[nn].buildable_to then elseif minetest.registered_nodes[nn].buildable_to then
-- buildable; replace the node -- buildable; replace the node
local pns = user:get_player_name() local pns = user:get_player_name()
@ -116,7 +134,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
-- Handle bucket item and inventory stuff -- Handle bucket item and inventory stuff
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
-- Add empty bucket and put it into invntory, if possible. -- Add empty bucket and put it into inventory, if possible.
-- Drop empty bucket otherwise. -- Drop empty bucket otherwise.
local new_bucket = ItemStack("bucket:bucket_empty") local new_bucket = ItemStack("bucket:bucket_empty")
if itemstack:get_count() == 1 then if itemstack:get_count() == 1 then
@ -174,6 +192,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
end end
minetest.add_node(pointed_thing.under, {name="air"}) minetest.add_node(pointed_thing.under, {name="air"})
sound_take(nn, pointed_thing.under)
if doc.entry_exists("nodes", nn) then if doc.entry_exists("nodes", nn) then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn) doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn)
@ -185,6 +204,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
new_bucket = ItemStack("bucket:bucket_water") new_bucket = ItemStack("bucket:bucket_water")
end end
sound_take("mcl_core:water_source", pointed_thing.under)
end end
-- Add liquid bucket and put it into inventory, if possible. -- Add liquid bucket and put it into inventory, if possible.