Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit furnace sound volume on catch-up smelting #3144

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions mods/default/furnace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ local function furnace_node_timer(pos, elapsed)
local fuel

local update = true
local items_smelt = 0
while elapsed > 0 and update do
update = false

Expand Down Expand Up @@ -171,9 +172,7 @@ 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.07}, true)
items_smelt = items_smelt + 1
else
-- Item could not be cooked: probably missing fuel
update = true
Expand Down Expand Up @@ -224,6 +223,11 @@ local function furnace_node_timer(pos, elapsed)
elapsed = elapsed - el
end

if items_smelt > 0 then
-- Play cooling sound
minetest.sound_play("default_cool_lava",
{ pos = pos, max_hear_distance = 16, gain = 0.07 * math.min(items_smelt, 7) }, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to not let it get arbitrarily loud; how did you choose this? I assume you roughly went for ~0.5 max gain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, I went for 0.05, realizing that it works but was too quiet, so I increased that to 0.07.

end
if fuel and fuel_totaltime > fuel.time then
fuel_totaltime = fuel.time
end
Expand Down