Skip to content

Commit 77bbcee

Browse files
authored
Limit furnace sound volume on catch-up smelting (luanti-org#3144)
1 parent da0509c commit 77bbcee

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mods/default/furnace.lua

+7-3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ local function furnace_node_timer(pos, elapsed)
134134
local fuel
135135

136136
local update = true
137+
local items_smelt = 0
137138
while elapsed > 0 and update do
138139
update = false
139140

@@ -171,9 +172,7 @@ local function furnace_node_timer(pos, elapsed)
171172
else
172173
dst_full = true
173174
end
174-
-- Play cooling sound
175-
minetest.sound_play("default_cool_lava",
176-
{pos = pos, max_hear_distance = 16, gain = 0.07}, true)
175+
items_smelt = items_smelt + 1
177176
else
178177
-- Item could not be cooked: probably missing fuel
179178
update = true
@@ -224,6 +223,11 @@ local function furnace_node_timer(pos, elapsed)
224223
elapsed = elapsed - el
225224
end
226225

226+
if items_smelt > 0 then
227+
-- Play cooling sound
228+
minetest.sound_play("default_cool_lava",
229+
{ pos = pos, max_hear_distance = 16, gain = 0.07 * math.min(items_smelt, 7) }, true)
230+
end
227231
if fuel and fuel_totaltime > fuel.time then
228232
fuel_totaltime = fuel.time
229233
end

0 commit comments

Comments
 (0)