summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlockMen <nmuelll@web.de>2013-07-01 09:39:13 +0200
committerBlockMen <nmuelll@web.de>2013-07-01 09:39:13 +0200
commit2a7c154cee1af2fc6a239044d72a3e3c604724ed (patch)
treee6354967bd84be3cc91f8c15c65b1d44359fbe81
parenta22a08f06d7ee3221883649ad420548c3d85a162 (diff)
Tweak override and add more food
-rw-r--r--hunger.lua42
1 files changed, 28 insertions, 14 deletions
diff --git a/hunger.lua b/hunger.lua
index 36f2ddd..44fcb43 100644
--- a/hunger.lua
+++ b/hunger.lua
@@ -14,23 +14,37 @@ function hud.item_eat(hunger_change, replace_with_item)
end
end
-local function overwrite(name, hunger_change, as_node)
+local function overwrite(name, hunger_change, replace_with_item)
local tab = minetest.registered_items[name]
if tab == nil then return end
- local tab2 = {}
- for i,v in pairs(tab) do
- tab2[i] = v
- end
- tab2.on_use = hud.item_eat(hunger_change)
-
- if as_node then
- minetest.register_node(":"..name, tab2)
- else
- minetest.register_craftitem(":"..name, tab2)
- end
+ tab.on_use = hud.item_eat(hunger_change)--, replace_with_item)
+ minetest.registered_items[name] = tab
end
-overwrite("default:apple", 2, true)
+overwrite("default:apple", 2)
if minetest.get_modpath("farming") ~= nil then
- overwrite("farming:bread", 4, false)
+ overwrite("farming:bread", 4)
+end
+
+if minetest.get_modpath("mobs") ~= nil then
+ overwrite("mobs:meat", 6)
+ overwrite("mobs:rat_cooked", 5)
+end
+
+if minetest.get_modpath("moretrees") ~= nil then
+ overwrite("moretrees:coconut_milk", 1)
+ overwrite("moretrees:raw_coconut", 2)
+ overwrite("moretrees:acorn_muffin", 3)
+ overwrite("moretrees:spruce_nuts", 1)
+ overwrite("moretrees:pine_nuts", 1)
+ overwrite("moretrees:fir_nuts", 1)
+end
+
+if minetest.get_modpath("dwarves") ~= nil then
+ overwrite("dwarves:beer", 2)
+ overwrite("dwarves:apple_cider", 1)
+ overwrite("dwarves:midus", 2)
+ overwrite("dwarves:tequila", 2)
+ overwrite("dwarves:tequila_with_lime", 2)
+ overwrite("dwarves:sake", 2)
end