Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add furnace sounds (#2569)
Two sounds are played; one while the furnace is active (sound used is "fire_fire") and one after an item is cooked (sound used is "default_cool_lava").
  • Loading branch information
An0n3m0us committed Aug 7, 2020
1 parent 4858c2b commit 0a96bac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mods/default/README.txt
Expand Up @@ -340,6 +340,10 @@ sonictechtonic (CC BY 3.0):
https://www.freesound.org/people/sonictechtonic/sounds/241872/
player_damage.ogg

iankath (CC0 1.0)
https://freesound.org/people/iankath/sounds/173991/
default_furnace_active.ogg


Models
------
Expand Down
13 changes: 13 additions & 0 deletions mods/default/furnace.lua
Expand Up @@ -113,6 +113,9 @@ local function furnace_node_timer(pos, elapsed)
local srclist, fuellist
local dst_full = false

local timer_elapsed = meta:get_int("timer_elapsed") or 0
meta:set_int("timer_elapsed", timer_elapsed + 1)

local cookable, cooked
local fuel

Expand Down Expand Up @@ -154,6 +157,9 @@ local function furnace_node_timer(pos, elapsed)
else
dst_full = true
end
-- Play cooling sound
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.1}, true)
else
-- Item could not be cooked: probably missing fuel
update = true
Expand Down Expand Up @@ -237,6 +243,12 @@ local function furnace_node_timer(pos, elapsed)
swap_node(pos, "default:furnace_active")
-- make sure timer restarts automatically
result = true

-- Play sound every 5 seconds while the furnace is active
if timer_elapsed == 0 or (timer_elapsed+1) % 5 == 0 then
minetest.sound_play("default_furnace_active",
{pos = pos, max_hear_distance = 16, gain = 0.5}, true)
end
else
if fuellist and not fuellist[1]:is_empty() then
fuel_state = S("@1%", 0)
Expand All @@ -245,6 +257,7 @@ local function furnace_node_timer(pos, elapsed)
swap_node(pos, "default:furnace")
-- stop timer on the inactive furnace
minetest.get_node_timer(pos):stop()
meta:set_int("timer_elapsed", 0)
end


Expand Down
Binary file added mods/default/sounds/default_furnace_active.ogg
Binary file not shown.

0 comments on commit 0a96bac

Please sign in to comment.