Don't stop music after digging empty jukebox

This commit is contained in:
Wuzzy 2017-01-11 22:54:31 +01:00
parent 61c7a51818
commit 7372f5fc2b

View File

@ -129,10 +129,6 @@ minetest.register_node("mcl_jukebox:jukebox", {
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
local name = digger:get_player_name() local name = digger:get_player_name()
if active_tracks[name] ~= nil then
minetest.sound_stop(active_tracks[name])
digger:hud_remove(active_huds[name])
end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta2 = meta local meta2 = meta
meta:from_table(oldmetadata) meta:from_table(oldmetadata)
@ -141,6 +137,10 @@ minetest.register_node("mcl_jukebox:jukebox", {
if not stack:is_empty() then if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack) minetest.add_item(p, stack)
if active_tracks[name] ~= nil then
minetest.sound_stop(active_tracks[name])
digger:hud_remove(active_huds[name])
end
end end
meta:from_table(meta2:to_table()) meta:from_table(meta2:to_table())
end, end,