Add sounds for Cauldron and Enchantment Table
parent
4fc0cb1687
commit
4fc78597ad
5
LICENSE
5
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/ |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
|
19
cooking.lua
19
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)
|
||||
})
|
||||
|
|
|
@ -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)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue