Update eating sound

This commit is contained in:
Wuzzy 2017-02-16 14:47:50 +01:00
parent 16bfda053d
commit 6912ca832c
6 changed files with 31 additions and 36 deletions

View file

@ -173,40 +173,6 @@ function minetest.item_drop(itemstack, dropper, pos)
end
end
--add food particles
function core.item_eat(hp_change, replace_with_item)
return function(itemstack, user, pointed_thing) -- closure
local pos = user:getpos()
pos.y = pos.y + item_drop_settings.player_collect_height
local itemname = itemstack:get_name()
local texture = minetest.registered_items[itemname].inventory_image
minetest.add_item(pos, drop)
minetest.add_particlespawner({
amount = 20,
time = 0.1,
minpos = {x=pos.x, y=pos.y, z=pos.z},
maxpos = {x=pos.x, y=pos.y, z=pos.z},
minvel = {x=-1, y=1, z=-1},
maxvel = {x=1, y=2, z=1},
minacc = {x=0, y=-5, z=0},
maxacc = {x=0, y=-9, z=0},
minexptime = 1,
maxexptime = 1,
minsize = 1,
maxsize = 2,
collisiondetection = true,
vertical = false,
texture = texture,
})
minetest.sound_play("bite_item_drop", {
pos = pos,
max_hear_distance = 100,
gain = 10.0,
})
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
end
end
--modify builtin:item
local time_to_live = tonumber(core.setting_get("item_entity_ttl"))