Do not allow negative hunger

This commit is contained in:
Wuzzy 2017-05-20 20:40:22 +02:00
parent c328a9b1bc
commit 690e81c0fe

@ -152,7 +152,7 @@ function mcl_hunger.exhaust(playername, increase)
satuchanged = true satuchanged = true
elseif mcl_hunger.saturation[playername] < 0.0001 then elseif mcl_hunger.saturation[playername] < 0.0001 then
h = mcl_hunger.get_hunger_raw(player) h = mcl_hunger.get_hunger_raw(player)
h = h-1 h = math.max(h-1, 0)
mcl_hunger.hunger[playername] = h mcl_hunger.hunger[playername] = h
mcl_hunger.set_hunger_raw(player) mcl_hunger.set_hunger_raw(player)
satuchanged = true satuchanged = true