diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index 1e843a2e69..f6c4802211 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -139,18 +139,17 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou }) end - -- Saturation + -- 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 - -- Healing - if hp < 20 and heal then - hp = hp + heal - if hp > 20 then hp = 20 end - user:set_hp(hp) + -- Dummy saturation (= hunger change) + -- TODO: Use food's actual saturation value + if hunger_change then + mcl_hunger.saturate(name, hunger_change) end -- Poison if poisen then diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index d58b920f47..cff1254c3e 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -150,11 +150,11 @@ end function mcl_hunger.saturate(playername, increase) local player = minetest.get_player_by_name(playername) - mcl_hunger.exhaustion[playername] = mcl_hunger.exhaustion[playername] + increase + mcl_hunger.saturation[playername] = mcl_hunger.saturation[playername] + increase if mcl_hunger.saturation[playername] > mcl_hunger.get_hunger(player) then mcl_hunger.saturation[playername] = mcl_hunger.get_hunger(player) end - hb.change_hudbar(player, "saturation", mcl_hunger.saturation[playername]) + hb.change_hudbar(player, "saturation", mcl_hunger.saturation[playername], mcl_hunger.get_hunger(player)) end local main_timer = 0 @@ -214,6 +214,9 @@ minetest.register_globalstep(function(dtime) if controls.up or controls.down or controls.left or controls.right then -- TODO: Add exhaustion for moving in water end + if controls.jump then + mcl_hunger.exhaust(name, mcl_hunger.EXHAUST_JUMP) + end end end end