Generalize status effects.

This commit is contained in:
Duane 2016-06-30 17:54:33 -05:00
parent e5005dd8d6
commit b486af8627
5 changed files with 76 additions and 24 deletions

View file

@ -43,7 +43,7 @@ end
if not fun_caves.db then
fun_caves.db = {}
end
for _, i in pairs({'teleport_data', 'hunger', 'armor_expire', 'translocators'}) do
for _, i in pairs({'teleport_data', 'hunger', 'status', 'translocators'}) do
if not fun_caves.db[i] then
fun_caves.db[i] = {}
end
@ -102,6 +102,17 @@ function fun_caves.clone_node(name)
end
fun_caves.registered_status = {}
function fun_caves.register_status(def)
fun_caves.registered_status[def.name] = {
remove = def.remove,
start = def.start,
during = def.during,
terminate = def.terminate,
}
end
--dofile(fun_caves.path .. "/recipe_list.lua")
dofile(fun_caves.path .. "/abms.lua")
@ -131,6 +142,14 @@ minetest.register_on_shutdown(function()
end)
minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
if not fun_caves.db.status[player_name] then
fun_caves.db.status[player_name] = {}
end
end)
local hunger_mod = minetest.get_modpath("hunger")
fun_caves.hunger_id = {}