diff --git a/LICENSE b/LICENSE index 205cac2..a8edb40 100644 --- a/LICENSE +++ b/LICENSE @@ -3,6 +3,11 @@ | | | Code: GPL version 3 | | Textures: WTFPL (credits: Gambit, kilbith, Cisoun) | +| Sounds: | +| - xdecor_boiling_water.ogg - by Audionautics - CC BY-SA | +| freesound.org/people/Audionautics/sounds/133901/ | +| - xdecor_enchanting.ogg - by Timbre - CC BY-SA-NC | +| freesound.org/people/Timbre/sounds/221683/ | +----------------------------------------------------------------------+ diff --git a/cooking.lua b/cooking.lua index f3f4715..20e48a5 100644 --- a/cooking.lua +++ b/cooking.lua @@ -1,4 +1,4 @@ -local cauldron = {} +local cauldron, sounds = {}, {} -- Add more ingredients here that make a soup. local ingredients_list = { @@ -15,15 +15,27 @@ cauldron.cbox = { {0, 0, 0, 16, 8, 16} } +function cauldron.stop_sound(pos) + local spos = minetest.hash_node_position(pos) + if sounds[spos] then minetest.sound_stop(sounds[spos]) end +end + function cauldron.idle_construct(pos) local timer = minetest.get_node_timer(pos) timer:start(10.0) + cauldron.stop_sound(pos) end function cauldron.boiling_construct(pos) + local spos = minetest.hash_node_position(pos) + sounds[spos] = minetest.sound_play("xdecor_boiling_water", { + pos=pos, max_hear_distance=5, gain=0.8, loop=true + }) + local meta = minetest.get_meta(pos) - local timer = minetest.get_node_timer(pos) meta:set_string("infotext", "Cauldron (active) - Drop some foods inside to make a soup") + + local timer = minetest.get_node_timer(pos) timer:start(5.0) end @@ -133,6 +145,9 @@ xdecor.register("cauldron_empty", { on_rotate = screwdriver.rotate_simple, tiles = {"xdecor_cauldron_top_empty.png", "xdecor_cauldron_sides.png"}, infotext = "Cauldron (empty)", + on_construct = function(pos) + cauldron.stop_sound(pos) + end, on_rightclick = cauldron.filling, collision_box = xdecor.pixelbox(16, cauldron.cbox) }) diff --git a/enchanting.lua b/enchanting.lua index 362c6b9..b87a554 100644 --- a/enchanting.lua +++ b/enchanting.lua @@ -58,7 +58,7 @@ function enchanting.on_put(pos, listname, _, stack) end end -function enchanting.fields(pos, _, fields) +function enchanting.fields(pos, _, fields, sender) if fields.quit then return end local inv = minetest.get_meta(pos):get_inventory() local tool = inv:get_stack("tool", 1) @@ -68,6 +68,7 @@ function enchanting.fields(pos, _, fields) local enchanted_tool = (mod or "")..":enchanted_"..(name or "").."_"..next(fields) if mese:get_count() >= mese_cost and minetest.registered_tools[enchanted_tool] then + minetest.sound_play("xdecor_enchanting", {to_player=sender:get_player_name(), gain=0.8}) tool:replace(enchanted_tool) tool:add_wear(orig_wear) mese:take_item(mese_cost) diff --git a/sounds/xdecor_boiling_water.ogg b/sounds/xdecor_boiling_water.ogg new file mode 100644 index 0000000..cc1e7a5 Binary files /dev/null and b/sounds/xdecor_boiling_water.ogg differ diff --git a/sounds/xdecor_enchanting.ogg b/sounds/xdecor_enchanting.ogg new file mode 100644 index 0000000..882e9ee Binary files /dev/null and b/sounds/xdecor_enchanting.ogg differ