Fixed custom sound

This commit is contained in:
BrunoMine 2016-10-20 15:25:19 -02:00
parent ba6bfffc9d
commit 3763748e89
1 changed files with 2 additions and 2 deletions

View File

@ -70,13 +70,13 @@ local function poisenp(tick, time, time_left, player)
end end
function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal) function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound)
return function(itemstack, user, pointed_thing) return function(itemstack, user, pointed_thing)
if itemstack:take_item() ~= nil and user ~= nil then if itemstack:take_item() ~= nil and user ~= nil then
local name = user:get_player_name() local name = user:get_player_name()
local h = tonumber(hbhunger.hunger[name]) local h = tonumber(hbhunger.hunger[name])
local hp = user:get_hp() local hp = user:get_hp()
minetest.sound_play({name = "hbhunger_eat_generic", gain = 1}, {pos=user:getpos(), max_hear_distance = 16}) minetest.sound_play({name = sound or "hbhunger_eat_generic", gain = 1}, {pos=user:getpos(), max_hear_distance = 16})
-- Saturation -- Saturation
if h < 30 and hunger_change then if h < 30 and hunger_change then