forked from MineClone5/MineClone5
Fix crash for missing _mcl_saturation
This commit is contained in:
parent
aeff735b87
commit
6518fa7599
|
@ -136,10 +136,12 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
|
||||||
|
|
||||||
if hunger_change then
|
if hunger_change then
|
||||||
-- Add saturation (must be defined in item table)
|
-- Add saturation (must be defined in item table)
|
||||||
local saturation = math.floor(minetest.registered_items[itemname]._mcl_saturation * 10)
|
local _mcl_saturation = minetest.registered_items[itemname]._mcl_saturation
|
||||||
if not saturation then
|
local saturation
|
||||||
|
if not _mcl_saturation then
|
||||||
saturation = 0
|
saturation = 0
|
||||||
minetest.log("warning", "[mcl_hunger] No saturation defined for item “"..itemname.."”!")
|
else
|
||||||
|
saturation = math.floor(minetest.registered_items[itemname]._mcl_saturation * 10)
|
||||||
end
|
end
|
||||||
mcl_hunger.saturate(name, saturation, false)
|
mcl_hunger.saturate(name, saturation, false)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue