Fix Undeclared Global variable warning for "diet"

This commit is contained in:
sys4-fr 2018-03-17 09:36:24 +01:00
parent 99a57d45d8
commit e50862606e

View File

@ -5,9 +5,10 @@
local redo = farming.mod and farming.mod == "redo" local redo = farming.mod and farming.mod == "redo"
local plus = minetest.get_modpath("farming_plus") local plus = minetest.get_modpath("farming_plus")
local diet_mod = minetest.get_modpath("diet")
local function item_eat(hunger_change, replace_with_item, poisen, heal) local function item_eat(hunger_change, replace_with_item, poisen, heal)
if diet then if diet_mod and diet then
return diet.item_eat(hunger_change, replace_with_item, poisen, heal) return diet.item_eat(hunger_change, replace_with_item, poisen, heal)
else else
return minetest.item_eat(hunger_change) return minetest.item_eat(hunger_change)