Add saturation value to food items
This commit is contained in:
parent
a300831614
commit
3291fcb054
14 changed files with 45 additions and 3 deletions
|
@ -146,10 +146,14 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
|
|||
mcl_hunger.hunger[name] = h
|
||||
mcl_hunger.set_hunger_raw(user)
|
||||
end
|
||||
-- Dummy saturation (= hunger change)
|
||||
-- TODO: Use food's actual saturation value
|
||||
-- Add saturation (must be defined in item table)
|
||||
if hunger_change then
|
||||
mcl_hunger.saturate(name, hunger_change)
|
||||
local saturation = minetest.registered_items[itemname]._mcl_saturation
|
||||
if not saturation then
|
||||
saturation = 0.0
|
||||
minetest.log("warning", "[mcl_hunger] No saturation defined for item “"..itemname.."”!")
|
||||
end
|
||||
mcl_hunger.saturate(name, saturation)
|
||||
end
|
||||
-- Poison
|
||||
if poisen then
|
||||
|
|
|
@ -214,6 +214,8 @@ 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
|
||||
-- Jumping
|
||||
-- FIXME: This is quite hacky and doesn't check if the player is actually jumping
|
||||
if controls.jump then
|
||||
mcl_hunger.exhaust(name, mcl_hunger.EXHAUST_JUMP)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue