]> git.lizzy.rs Git - xdecor.git/commitdiff
Add sounds for Cauldron and Enchantment Table
authorkilbith <jeanpatrick.guerrero@gmail.com>
Wed, 13 Apr 2016 18:33:29 +0000 (20:33 +0200)
committerkilbith <jeanpatrick.guerrero@gmail.com>
Wed, 13 Apr 2016 18:35:26 +0000 (20:35 +0200)
LICENSE
cooking.lua
enchanting.lua
sounds/xdecor_boiling_water.ogg [new file with mode: 0644]
sounds/xdecor_enchanting.ogg [new file with mode: 0644]

diff --git a/LICENSE b/LICENSE
index 205cac2b24345ae66ddd262cce837787210041aa..a8edb403c88e1929b293f1bb77bbae983ba3eb64 100644 (file)
--- 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/                  |
 +----------------------------------------------------------------------+
 
 
index f3f4715c80edeeae62d6a456f4cd3274efb63227..20e48a5ad2f7fa6129faa490748507113525957a 100644 (file)
@@ -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)
 })
index 362c6b9d1fa261cf0d2a836408231c1d96263478..b87a5541861b0b72a1474079c9bd189223a2b7c7 100644 (file)
@@ -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 (file)
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 (file)
index 0000000..882e9ee
Binary files /dev/null and b/sounds/xdecor_enchanting.ogg differ