This commit is contained in:
rubenwardy 2015-01-04 17:31:30 +00:00
parent 2897fe334f
commit ca32dc17ce
5 changed files with 24 additions and 15 deletions

3
food/depends.txt Normal file
View File

@ -0,0 +1,3 @@
diet?
hud?
intllib?

View File

@ -6,15 +6,6 @@
-- The supporting api for the mod -- The supporting api for the mod
-- ===================================== -- =====================================
-- Boilerplate to support localized strings if intllib mod is installed.
S = 0
if (intllib) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
food = { food = {
modules = {}, modules = {},
disabled_modules = {}, disabled_modules = {},
@ -70,7 +61,7 @@ function food.support(group, item)
minetest.override_item(item, {groups = g}) minetest.override_item(item, {groups = g})
end end
function food.disable(name) function food.disable(name)
if type(name) == "table" then if type(name) == "table" then
for i = 1, #name do for i = 1, #name do
food.disable(name[i]) food.disable(name[i])
@ -99,7 +90,7 @@ function food.module(name, func, ingred)
return return
end end
end end
if food.debug then if food.debug then
print("[Food Debug] Registering " .. name .. " fallback definition") print("[Food Debug] Registering " .. name .. " fallback definition")
end end
@ -111,9 +102,9 @@ end
-- Checks for hunger mods to register food on -- Checks for hunger mods to register food on
function food.item_eat(amt) function food.item_eat(amt)
if minetest.get_modpath("diet") then if minetest.get_modpath("diet") and diet and diet.item_eat then
return diet.item_eat(amt) return diet.item_eat(amt)
elseif minetest.get_modpath("hud") then elseif minetest.get_modpath("hud") and hud and hud.item_eat then
return hud.item_eat(amt) return hud.item_eat(amt)
else else
return minetest.item_eat(amt) return minetest.item_eat(amt)

View File

@ -3,10 +3,8 @@ animalmaterials?
bushes_classic? bushes_classic?
default? default?
docfarming? docfarming?
diet?
farming? farming?
farming_plus? farming_plus?
hud?
intllib? intllib?
jkanimals? jkanimals?
jkfarming? jkfarming?

View File

@ -6,6 +6,15 @@
-- Fallback ingredients -- Fallback ingredients
-- ===================================== -- =====================================
-- Boilerplate to support localized strings if intllib mod is installed.
local S = 0
if (intllib) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
food.module("wheat", function() food.module("wheat", function()
minetest.register_craftitem(":food:wheat", { minetest.register_craftitem(":food:wheat", {
description = S("Wheat"), description = S("Wheat"),

View File

@ -11,6 +11,14 @@ print("Food Mod - Version 2.3")
dofile(minetest.get_modpath("food_basic").."/support.lua") dofile(minetest.get_modpath("food_basic").."/support.lua")
dofile(minetest.get_modpath("food_basic").."/ingredients.lua") dofile(minetest.get_modpath("food_basic").."/ingredients.lua")
-- Boilerplate to support localized strings if intllib mod is installed.
local S = 0
if (intllib) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
-- Register dark chocolate -- Register dark chocolate
food.module("dark_chocolate", function() food.module("dark_chocolate", function()