From daf42e45c3c278b15aa7737ca29a5e7cd44f8434 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 20 May 2017 20:00:26 +0200 Subject: [PATCH] Limit saturation bonus by max food points --- mods/PLAYER/mcl_hunger/hunger.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index b7d76e4dd0..f1acb8d4ef 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -139,13 +139,6 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou }) end - -- Food points - if h < 20 and hunger_change then - h = h + hunger_change - if h > 20 then h = 20 end - mcl_hunger.hunger[name] = h - mcl_hunger.set_hunger_raw(user) - end -- Add saturation (must be defined in item table) if hunger_change then local saturation = minetest.registered_items[itemname]._mcl_saturation @@ -155,6 +148,13 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou end mcl_hunger.saturate(name, saturation) end + -- Food points + if h < 20 and hunger_change then + h = h + hunger_change + if h > 20 then h = 20 end + mcl_hunger.hunger[name] = h + mcl_hunger.set_hunger_raw(user) + end -- Poison if poisen then -- Set poison bar