Support for mods hunger, hunger_ng and diet added.
This commit is contained in:
parent
0c857ed608
commit
b8bf273eba
@ -1,3 +1,4 @@
|
||||
Support for mods hunger, hunger_ng and diet added.
|
||||
Code reworked.
|
||||
Sea anemone added.
|
||||
Readme changed.
|
||||
|
1
init.lua
1
init.lua
@ -38,5 +38,6 @@ dofile(aqua_farming.modpath .. "/alga.lua")
|
||||
dofile(aqua_farming.modpath .. "/sea_strawberry.lua")
|
||||
dofile(aqua_farming.modpath .. "/sea_grass.lua")
|
||||
dofile(aqua_farming.modpath .. "/sea_anemone.lua")
|
||||
dofile(aqua_farming.modpath .. "/support_mods.lua")
|
||||
|
||||
aqua_farming.report(" successfully loaded.")
|
||||
|
1
mod.conf
1
mod.conf
@ -1,2 +1,3 @@
|
||||
name = aqua_farming
|
||||
depends = default
|
||||
optional depends = hunger_ng, hunger, diet
|
||||
|
56
support_mods.lua
Normal file
56
support_mods.lua
Normal file
@ -0,0 +1,56 @@
|
||||
local af_items = {
|
||||
-- Name Saturation Replace with Poison Heal Sound
|
||||
-- crops
|
||||
{'aqua_farming:alga_items', 1, nil, nil, nil, nil},
|
||||
{'aqua_farming:sea_strawberry_item', 3, nil, nil, nil, nil},
|
||||
{'cucina_vegana:sea_anemone_item', 3, nil, nil, 1, nil},
|
||||
|
||||
}
|
||||
|
||||
|
||||
-- *******************************************
|
||||
-- ***** Hunger-Support *****
|
||||
-- *******************************************
|
||||
|
||||
if(minetest.get_modpath("hunger")) then
|
||||
for key, item in pairs(af_items) do
|
||||
hunger.register_food(item)
|
||||
|
||||
end -- for key, data
|
||||
|
||||
end -- hunger
|
||||
|
||||
-- **********************************************
|
||||
-- ***** Hunger_ng-Support *****
|
||||
-- **********************************************
|
||||
|
||||
if(minetest.get_modpath("hunger_ng")) then
|
||||
local add = hunger_ng.add_hunger_data
|
||||
|
||||
for key, item in pairs(af_items) do
|
||||
add(item[1], {satiates = item[2], returns = item[3], heals = math.floor((item[5] or 0)), timeout = 0})
|
||||
|
||||
end -- for key, data
|
||||
|
||||
end -- hunger_ng
|
||||
|
||||
-- *******************************************
|
||||
-- ***** Diet-Support *****
|
||||
-- *******************************************
|
||||
|
||||
if(minetest.get_modpath("diet")) then
|
||||
|
||||
local function overwrite(name, hunger_change, replace_with_item, poisen, heal)
|
||||
local tab = minetest.registered_items[name]
|
||||
if not tab then
|
||||
return
|
||||
end
|
||||
tab.on_use = diet.item_eat(hunger_change, replace_with_item, poisen, heal)
|
||||
end -- local function overwrite
|
||||
|
||||
for key,item in pairs(af_items) do
|
||||
overwrite(item[1], item[2], item[3], item[4], item[5])
|
||||
|
||||
end -- for key,item
|
||||
|
||||
end -- if(minetest.get_modpath("diet
|
Loading…
x
Reference in New Issue
Block a user