Play sound at eater, add random pitch

This commit is contained in:
Wuzzy 2019-09-24 18:20:12 +02:00
parent ebf40debc6
commit 91d6d3de5d
1 changed files with 7 additions and 1 deletions

View File

@ -79,7 +79,13 @@ function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound
if h == nil or hp == nil then
return
end
minetest.sound_play({name = sound or "hbhunger_eat_generic", gain = 1}, {pos=user:getpos(), max_hear_distance = 16})
minetest.sound_play(
{name = sound or "hbhunger_eat_generic",
gain = 1},
{object=user,
max_hear_distance = 16,
pitch = 1 + math.random(-10, 10)*0.005,}
)
-- Saturation
if h < 30 and hunger_change then