1
0
Fork 0

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() local pos = user:getpos()
pos.y = pos.y + item_drop_settings.player_collect_height pos.y = pos.y + item_drop_settings.player_collect_height
local texture = minetest.registered_items[itemname].inventory_image
-- FIXME: Is this correct? o_O -- FIXME: Is this correct? o_O
minetest.add_item(pos, drop) minetest.add_item(pos, drop)
local foodtype = minetest.get_item_group(itemname, "food") 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 else
-- Assume the item is a food -- Assume the item is a food
-- Add eat particle effect and sound -- Add eat particle effect and sound
minetest.add_particlespawner({ local texture = minetest.registered_items[itemname].inventory_image
amount = 20, if not texture or texture == "" then
time = 0.1, texture = minetest.registered_items[itemname].wield_image
minpos = {x=pos.x, y=pos.y, z=pos.z}, end
maxpos = {x=pos.x, y=pos.y, z=pos.z}, if texture and texture ~= "" then
minvel = {x=-1, y=1, z=-1}, minetest.add_particlespawner({
maxvel = {x=1, y=2, z=1}, amount = 20,
minacc = {x=0, y=-5, z=0}, time = 0.1,
maxacc = {x=0, y=-9, z=0}, minpos = {x=pos.x, y=pos.y, z=pos.z},
minexptime = 1, maxpos = {x=pos.x, y=pos.y, z=pos.z},
maxexptime = 1, minvel = {x=-1, y=1, z=-1},
minsize = 1, maxvel = {x=1, y=2, z=1},
maxsize = 2, minacc = {x=0, y=-5, z=0},
collisiondetection = true, maxacc = {x=0, y=-9, z=0},
vertical = false, minexptime = 1,
texture = texture, maxexptime = 1,
}) minsize = 1,
maxsize = 2,
collisiondetection = true,
vertical = false,
texture = texture,
})
end
minetest.sound_play("mcl_hunger_bite", { minetest.sound_play("mcl_hunger_bite", {
pos = pos, pos = pos,
max_hear_distance = 12, max_hear_distance = 12,