Skip to content
This repository has been archived by the owner on Sep 3, 2020. It is now read-only.

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jan 4, 2015
1 parent 2897fe3 commit ca32dc1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
3 changes: 3 additions & 0 deletions food/depends.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
diet?
hud?
intllib?
17 changes: 4 additions & 13 deletions food/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
-- 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 = {
modules = {},
disabled_modules = {},
Expand Down Expand Up @@ -70,7 +61,7 @@ function food.support(group, item)
minetest.override_item(item, {groups = g})
end

function food.disable(name)
function food.disable(name)
if type(name) == "table" then
for i = 1, #name do
food.disable(name[i])
Expand Down Expand Up @@ -99,7 +90,7 @@ function food.module(name, func, ingred)
return
end
end

if food.debug then
print("[Food Debug] Registering " .. name .. " fallback definition")
end
Expand All @@ -111,9 +102,9 @@ end

-- Checks for hunger mods to register food on
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)
elseif minetest.get_modpath("hud") then
elseif minetest.get_modpath("hud") and hud and hud.item_eat then
return hud.item_eat(amt)
else
return minetest.item_eat(amt)
Expand Down
2 changes: 0 additions & 2 deletions food_basic/depends.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ animalmaterials?
bushes_classic?
default?
docfarming?
diet?
farming?
farming_plus?
hud?
intllib?
jkanimals?
jkfarming?
Expand Down
9 changes: 9 additions & 0 deletions food_basic/ingredients.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
-- 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()
minetest.register_craftitem(":food:wheat", {
description = S("Wheat"),
Expand Down
8 changes: 8 additions & 0 deletions food_basic/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ print("Food Mod - Version 2.3")
dofile(minetest.get_modpath("food_basic").."/support.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
food.module("dark_chocolate", function()
Expand Down

0 comments on commit ca32dc1

Please sign in to comment.