mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
Use table.update() on mcl_hunger.eat_internal[name] in the item eat code
This commit is contained in:
parent
c0a5c63601
commit
5154dce8d0
1 changed files with 11 additions and 9 deletions
|
@ -40,15 +40,17 @@ function minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, poi
|
||||||
-- Don't allow eating when player has full hunger bar (some exceptional items apply)
|
-- Don't allow eating when player has full hunger bar (some exceptional items apply)
|
||||||
if not no_eat_delay and not mcl_hunger.eat_internal[name].is_eating and not mcl_hunger.eat_internal[name].do_item_eat and (can_eat_when_full or (mcl_hunger.get_hunger(user) < 20)) then
|
if not no_eat_delay and not mcl_hunger.eat_internal[name].is_eating and not mcl_hunger.eat_internal[name].do_item_eat and (can_eat_when_full or (mcl_hunger.get_hunger(user) < 20)) then
|
||||||
local itemname = itemstack:get_name()
|
local itemname = itemstack:get_name()
|
||||||
mcl_hunger.eat_internal[name].is_eating = true
|
table.update(mcl_hunger.eat_internal[name], {
|
||||||
mcl_hunger.eat_internal[name].is_eating_no_padding = true
|
is_eating = true,
|
||||||
mcl_hunger.eat_internal[name].itemname = itemname
|
is_eating_no_padding = true,
|
||||||
mcl_hunger.eat_internal[name].item_definition = minetest.registered_items[itemname]
|
itemname = itemname,
|
||||||
mcl_hunger.eat_internal[name].hp_change = hp_change
|
item_definition = minetest.registered_items[itemname],
|
||||||
mcl_hunger.eat_internal[name].replace_with_item = replace_with_item
|
hp_change = hp_change,
|
||||||
mcl_hunger.eat_internal[name].itemstack = itemstack
|
replace_with_item = replace_with_item,
|
||||||
mcl_hunger.eat_internal[name].user = user
|
itemstack = itemstack,
|
||||||
mcl_hunger.eat_internal[name].pointed_thing = pointed_thing
|
user = user,
|
||||||
|
pointed_thing = pointed_thing
|
||||||
|
})
|
||||||
elseif (mcl_hunger.eat_internal[name].do_item_eat or no_eat_delay) and (can_eat_when_full or (mcl_hunger.get_hunger(user) < 20)) then
|
elseif (mcl_hunger.eat_internal[name].do_item_eat or no_eat_delay) and (can_eat_when_full or (mcl_hunger.get_hunger(user) < 20)) then
|
||||||
if mcl_hunger.eat_internal[name]._custom_itemstack and
|
if mcl_hunger.eat_internal[name]._custom_itemstack and
|
||||||
mcl_hunger.eat_internal[name]._custom_wrapper and
|
mcl_hunger.eat_internal[name]._custom_wrapper and
|
||||||
|
|
Loading…
Reference in a new issue