Add API functions to get the current effect time

This commit is contained in:
Wuzzy
2014-07-17 18:36:06 +02:00
parent 7bfd30ce39
commit a97ddfd942
2 changed files with 38 additions and 0 deletions

View File

@ -199,6 +199,26 @@ function playereffects.cancel_effect_group(groupname, playername)
end
end
function playereffects.get_remaining_effect_time(effect_id)
local now = os.time()
local effect = playereffects.effects[effect_id]
if(effect ~= nil) then
return (effect.time_left - os.difftime(now, effect.start_time))
else
return nil
end
end
function playereffects.get_passed_effect_time(effect_id)
local now = os.time()
local effect = playereffects.effects[effect_id]
if(effect ~= nil) then
return os.difftime(now, effect.start_time)
else
return nil
end
end
function playereffects.cancel_effect(effect_id)
local effect = playereffects.effects[effect_id]
if(effect ~= nil) then