steed/stead/timer.lua

24 lines
468 B
Lua
Raw Normal View History

2010-07-05 19:19:29 +03:00
game.action = stead.hook(game.action, function(f, s, cmd, ...)
if cmd == 'user_timer' then
2010-07-22 13:39:48 +03:00
local r,v
2010-07-27 10:36:08 +03:00
if here().timer then
2011-07-27 13:21:20 +03:00
r,v = stead.call(here(), 'timer');
2010-07-27 10:36:08 +03:00
elseif s.timer then
2011-07-27 13:21:20 +03:00
r,v = stead.call(s, 'timer');
2010-07-27 10:36:08 +03:00
end
2011-04-23 10:57:13 +03:00
if r == nil and v == nil and stead.api_version < "1.3.5" then
return nil, true
end
2010-07-22 13:39:48 +03:00
return r,v
2010-07-05 19:19:29 +03:00
end
2011-02-23 12:11:27 +02:00
return f(s, cmd, ...);
2010-07-05 19:19:29 +03:00
end)
2010-07-22 13:39:48 +03:00
stead.module_init(function()
timer.callback = function(s)
return 'user_timer'
end
end)
2010-07-06 13:15:27 +03:00
-- vim:ts=4