Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit 5fe4ded

Browse files
committed
Fix [food] crashing when damage is disabled (hbhunger not loading)
1 parent a4c02fd commit 5fe4ded

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mods/food/food/init.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,12 @@ function food.item_eat(amt)
107107
elseif minetest.get_modpath("hud") and hud and hud.item_eat then
108108
return hud.item_eat(amt)
109109
elseif minetest.get_modpath("hbhunger") then
110-
if hbhunger then
111-
return hbhunger.item_eat(amt)
112-
else
110+
if hbhunger and hbhunger.item_eat then -- hbhunger is nil when world is loaded with damage disabled
113111
return hbhunger.item_eat(amt)
114112
end
113+
return function(...) end
114+
elseif minetest.get_modpath("hunger") and hunger and hunger.item_eat then
115+
return hunger.item_eat(amt)
115116
else
116117
return minetest.item_eat(amt)
117118
end

0 commit comments

Comments
 (0)