| |
| 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/ |
+----------------------------------------------------------------------+
-local cauldron = {}
+local cauldron, sounds = {}, {}
-- Add more ingredients here that make a soup.
local ingredients_list = {
{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
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)
})
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)
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)