Don't show food particle without inv/wield img

This commit is contained in:
Wuzzy 2017-02-16 15:15:05 +01:00
parent c587d6316e
commit d798df0742
1 changed files with 23 additions and 18 deletions

View File

@ -80,7 +80,6 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
local pos = user:getpos()
pos.y = pos.y + item_drop_settings.player_collect_height
local texture = minetest.registered_items[itemname].inventory_image
-- FIXME: Is this correct? o_O
minetest.add_item(pos, drop)
local foodtype = minetest.get_item_group(itemname, "food")
@ -94,6 +93,11 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
else
-- Assume the item is a food
-- Add eat particle effect and sound
local texture = minetest.registered_items[itemname].inventory_image
if not texture or texture == "" then
texture = minetest.registered_items[itemname].wield_image
end
if texture and texture ~= "" then
minetest.add_particlespawner({
amount = 20,
time = 0.1,
@ -111,6 +115,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
vertical = false,
texture = texture,
})
end
minetest.sound_play("mcl_hunger_bite", {
pos = pos,
max_hear_distance = 12,