mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Fix crash for missing _mcl_saturation
This commit is contained in:
parent
aeff735b87
commit
6518fa7599
1 changed files with 5 additions and 3 deletions
|
@ -136,10 +136,12 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
|
|||
|
||||
if hunger_change then
|
||||
-- Add saturation (must be defined in item table)
|
||||
local saturation = math.floor(minetest.registered_items[itemname]._mcl_saturation * 10)
|
||||
if not saturation then
|
||||
local _mcl_saturation = minetest.registered_items[itemname]._mcl_saturation
|
||||
local saturation
|
||||
if not _mcl_saturation then
|
||||
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
|
||||
mcl_hunger.saturate(name, saturation, false)
|
||||
|
||||
|
|
Loading…
Reference in a new issue