Code cleanup in furnace code

This commit is contained in:
Wuzzy 2022-05-29 14:59:07 +02:00
parent de9d430b23
commit be9e69b4bd
1 changed files with 8 additions and 9 deletions

View File

@ -277,20 +277,19 @@ local function furnace_node_timer(pos, elapsed)
table.remove(furnace_fire_sounds[hash], 1) table.remove(furnace_fire_sounds[hash], 1)
end end
-- Remove the sound ID automatically from table after 11 seconds -- Remove the sound ID automatically from table after 11 seconds
minetest.after(11, function(t) minetest.after(11, function()
if not furnace_fire_sounds[t.hash] then if not furnace_fire_sounds[hash] then
return return
end end
for f=#furnace_fire_sounds[t.hash], 1, -1 do for f=#furnace_fire_sounds[hash], 1, -1 do
if furnace_fire_sounds[t.hash][f] == t.sound_id then if furnace_fire_sounds[hash][f] == sound_id then
minetest.log("error", "remove_after:"..t.sound_id) table.remove(furnace_fire_sounds[hash], f)
table.remove(furnace_fire_sounds[t.hash], f)
end end
end end
if #furnace_fire_sounds[t.hash] == 0 then if #furnace_fire_sounds[hash] == 0 then
furnace_fire_sounds[t.hash] = nil furnace_fire_sounds[hash] = nil
end end
end, {sound_id=sound_id, hash=hash}) end)
end end
else else
if fuellist and not fuellist[1]:is_empty() then if fuellist and not fuellist[1]:is_empty() then