steed/stead/click.lua

26 lines
584 B
Lua
Raw Normal View History

2010-06-23 15:09:33 +03:00
input.click = stead.hook(input.click,
2010-06-16 12:41:03 +03:00
function(f, s, press, mb, x, y, px, py, ...)
2010-06-07 16:53:00 +03:00
if press and px then
return "click "..px..','..py;
end
2010-06-16 12:41:03 +03:00
return f(s, press, mb, x, y, px, py, unpack(arg))
end)
2010-06-07 16:53:00 +03:00
2010-06-23 15:09:33 +03:00
game.action = stead.hook(game.action,
2010-06-07 16:53:00 +03:00
function(f, s, cmd, x, y, ...)
if cmd == 'click' then
2010-07-19 09:40:58 +03:00
local r,v
2010-06-09 13:19:11 +03:00
if here().click then
2010-07-19 09:40:58 +03:00
r,v = call(here(), 'click', x, y, unpack(arg));
elseif s.click then
r,v = call(s, 'click', x, y, unpack(arg));
2010-06-09 13:19:11 +03:00
end
2010-07-19 09:40:58 +03:00
if r == nil and v == nil then
return nil, true
2010-06-09 13:19:11 +03:00
end
2010-07-19 09:40:58 +03:00
return r,v
2010-06-07 16:53:00 +03:00
end
2010-06-16 08:05:23 +03:00
return f(s, cmd, x, y, unpack(arg))
2010-06-07 16:53:00 +03:00
end)
2010-07-06 13:15:27 +03:00
-- vim:ts=4