Attach wielded item sounds to moving player.

This commit is contained in:
Aaron Suen 2019-09-12 20:20:59 -04:00
parent 4f7a31dbd9
commit 05c60e031a
4 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ minetest.register_on_punchnode(function(pos, node, puncher)
if wield:get_wear() >= (65536 * 0.95) then
minetest.sound_play("nc_api_toolwear",
{pos = pos, gain = 0.5})
{object = puncher, gain = 0.5})
end
end)

View File

@ -10,7 +10,7 @@ nodecore.register_on_register_item(function(_, def)
if what:get_count() == 0 then
if def.sound and def.sound.breaks then
minetest.sound_play(def.sound.breaks,
{pos = who:get_pos(), gain = 0.5})
{object = who, gain = 0.5})
end
return ItemStack(def.tool_wears_to)
end

View File

@ -155,7 +155,7 @@ function nodecore.wear_wield(player, groups, qty)
if wielded:get_count() <= 0 and wdef.sound
and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks,
{pos = player:get_pos(), gain = 0.5})
{object = player, gain = 0.5})
end
end
end

View File

@ -9,7 +9,7 @@ local function wieldsound(player, idx, gain)
if def and def.sounds then
local t = {}
for k, v in pairs(def.sounds.dig) do t[k] = v end
t.pos = player:get_pos()
t.object = player
t.gain = gain or 1
if player:get_player_control().sneak then t.gain = t.gain / 4 end
return function() minetest.sound_play(t.name, t) end