Add strength elixirs.

This commit is contained in:
Duane 2016-07-13 05:31:54 -05:00
parent dd81a5777a
commit b6e66def05
10 changed files with 98 additions and 11 deletions

View file

@ -192,30 +192,26 @@ minetest.register_globalstep(function(dtime)
-- Remove status effects.
local status = fun_caves.db.status[player_name]
for name, stat in pairs(status) do
local def = fun_caves.registered_status[name]
for status_name, status_param in pairs(status) do
local def = fun_caves.registered_status[status_name]
if not def then
print('Fun Caves: Error - unregistered status ' .. name)
print('Fun Caves: Error - unregistered status ' .. status_name)
break
end
local remove
if type(stat.remove) == 'number' then
if stat.remove < time then
if type(status_param.remove) == 'number' then
if status_param.remove < time then
remove = true
end
elseif def.remove then
remove = def.remove(player)
else
print('Fun Caves: Error in status remove for ' .. name)
print('Fun Caves: Error in status remove for ' .. status_name)
end
if remove then
if def and def.terminate then
fun_caves.db.status[player_name][name] = def.terminate(player)
else
fun_caves.db.status[player_name][name] = nil
end
fun_caves.remove_status(player_name, status_name)
elseif def.during then
def.during(player)
end