Don't show food particle without inv/wield img
This commit is contained in:
parent
c587d6316e
commit
d798df0742
|
@ -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,23 +93,29 @@ 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
|
||||
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,
|
||||
})
|
||||
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,
|
||||
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,
|
||||
})
|
||||
end
|
||||
minetest.sound_play("mcl_hunger_bite", {
|
||||
pos = pos,
|
||||
max_hear_distance = 12,
|
||||
|
|
Loading…
Reference in New Issue