Behavior tweaks when eating "empty" food (#46)
- Allow eating food which doesn't restore saturation when the player is full - Don't apply poison effect when eating food that isn't actually poisonous
This commit is contained in:
parent
b5df973174
commit
9f1acb4eaa
7
init.lua
7
init.lua
@ -480,8 +480,8 @@ function minetest.do_item_eat(hp_change, replace_with_item, itemstack, player, p
|
||||
end
|
||||
|
||||
local level = stamina.get_saturation(player) or 0
|
||||
if level >= settings.visual_max then
|
||||
-- don't eat if player is full
|
||||
if level >= settings.visual_max and hp_change > 0 then
|
||||
-- don't eat if player is full and item provides saturation
|
||||
return itemstack
|
||||
end
|
||||
|
||||
@ -498,8 +498,7 @@ function minetest.do_item_eat(hp_change, replace_with_item, itemstack, player, p
|
||||
if hp_change > 0 then
|
||||
stamina.change_saturation(player, hp_change)
|
||||
stamina.set_exhaustion(player, 0)
|
||||
else
|
||||
-- assume hp_change < 0.
|
||||
elseif hp_change < 0 then
|
||||
stamina.poison(player, -hp_change, settings.poison_tick)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user