mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 01:21:05 +01:00
Don't show food particle without inv/wield img
This commit is contained in:
parent
c587d6316e
commit
d798df0742
1 changed files with 23 additions and 18 deletions
|
@ -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,6 +93,11 @@ 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
|
||||||
|
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({
|
minetest.add_particlespawner({
|
||||||
amount = 20,
|
amount = 20,
|
||||||
time = 0.1,
|
time = 0.1,
|
||||||
|
@ -111,6 +115,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = texture,
|
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,
|
||||||
|
|
Loading…
Reference in a new issue