Limit saturation bonus by max food points

This commit is contained in:
Wuzzy 2017-05-20 20:00:26 +02:00
parent 22b8ba6440
commit daf42e45c3
1 changed files with 7 additions and 7 deletions

View File

@ -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