summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2014-07-17 18:36:06 +0200
committerWuzzy <almikes@aol.com>2014-07-17 18:36:06 +0200
commita97ddfd942208249ce3c4df06154b1fad41f71f7 (patch)
treee280978095e2f7a87edf43721fa470a4fac29027 /init.lua
parent7bfd30ce392ace5b4795fab2dcb63926cf02ea67 (diff)
Add API functions to get the current effect time
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 42eefdf..d78b644 100644
--- a/init.lua
+++ b/init.lua
@@ -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