forked from VoxeLibre/VoxeLibre
Limit saturation bonus by max food points
This commit is contained in:
parent
22b8ba6440
commit
daf42e45c3
|
@ -139,13 +139,6 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
|
||||||
})
|
})
|
||||||
end
|
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)
|
-- Add saturation (must be defined in item table)
|
||||||
if hunger_change then
|
if hunger_change then
|
||||||
local saturation = minetest.registered_items[itemname]._mcl_saturation
|
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
|
end
|
||||||
mcl_hunger.saturate(name, saturation)
|
mcl_hunger.saturate(name, saturation)
|
||||||
end
|
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
|
-- Poison
|
||||||
if poisen then
|
if poisen then
|
||||||
-- Set poison bar
|
-- Set poison bar
|
||||||
|
|
Loading…
Reference in New Issue