1
0
Fork 0

Add objectref to villager sound_play for pos sound

mobs-redo
cora 2022-08-12 15:42:08 +02:00
parent 68d5a81b1c
commit 3620db7c14
1 changed files with 8 additions and 6 deletions

View File

@ -816,7 +816,7 @@ local function show_trade_formspec(playername, trader, tradenum)
.."listring[current_player;main]" .."listring[current_player;main]"
.."listring["..tradeinv..";input]" .."listring["..tradeinv..";input]"
.."listring[current_player;main]" .."listring[current_player;main]"
minetest.sound_play("mobs_mc_villager_trade", {to_player = playername}, true) minetest.sound_play("mobs_mc_villager_trade", {to_player = playername,object=trader.object}, true)
minetest.show_formspec(playername, tradeinv_name, formspec) minetest.show_formspec(playername, tradeinv_name, formspec)
end end
@ -878,13 +878,13 @@ local function update_offer(inv, player, sound)
(trade.locked == false)) then (trade.locked == false)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1)) inv:set_stack("output", 1, inv:get_stack("offered", 1))
if sound then if sound then
minetest.sound_play("mobs_mc_villager_accept", {to_player = name}, true) minetest.sound_play("mobs_mc_villager_accept", {to_player = name,object=trader.object}, true)
end end
return true return true
else else
inv:set_stack("output", 1, ItemStack("")) inv:set_stack("output", 1, ItemStack(""))
if sound then if sound then
minetest.sound_play("mobs_mc_villager_deny", {to_player = name}, true) minetest.sound_play("mobs_mc_villager_deny", {to_player = name,object=trader.object}, true)
end end
return false return false
end end
@ -1084,7 +1084,8 @@ local trade_inventory = {
if not wanted2:is_empty() then if not wanted2:is_empty() then
inv:remove_item("input", inv:get_stack("wanted", 2)) inv:remove_item("input", inv:get_stack("wanted", 2))
end end
minetest.sound_play("mobs_mc_villager_accept", {to_player = player:get_player_name()}, true) local trader = player_trading_with[name]
minetest.sound_play("mobs_mc_villager_accept", {to_player = player:get_player_name(),object=trader.object}, true)
end end
update_offer(inv, player, true) update_offer(inv, player, true)
end, end,
@ -1194,10 +1195,11 @@ local trade_inventory = {
elseif listname == "input" then elseif listname == "input" then
update_offer(inv, player, false) update_offer(inv, player, false)
end end
local trader = player_trading_with[name]
if accept then if accept then
minetest.sound_play("mobs_mc_villager_accept", {to_player = name}, true) minetest.sound_play("mobs_mc_villager_accept", {to_player = name,object=trader.object}, true)
else else
minetest.sound_play("mobs_mc_villager_deny", {to_player = name}, true) minetest.sound_play("mobs_mc_villager_deny", {to_player = name,object=trader.object}, true)
end end
end, end,
} }