click fix

This commit is contained in:
p.kosyh 2011-04-12 13:11:58 +00:00
parent 56bfc46512
commit 766f3d9dcd

View file

@ -32,19 +32,30 @@ stead.module_init(function()
end) end)
game.action = stead.hook(game.action, game.action = stead.hook(game.action,
function(f, s, cmd, x, y, ...) function(f, s, cmd, x, y, px, py, ...)
if cmd == 'click' then if cmd == 'click' then
local r,v local r,v
local x2 = px
local y2 = py
if tonumber(px) then
x2 = tonumber(px)
end
if tonumber(py) then
y2 = tonumber(py)
end
if here().click then if here().click then
r,v = call(here(), 'click', x, y, ...); r,v = call(here(), 'click', tonumber(x), tonumber(y), x2, y2, ...);
elseif s.click then elseif s.click then
r,v = call(s, 'click', x, y, ...); r,v = call(s, 'click', tonumber(x), tonumber(y), x2, y2, ...);
end end
if r == nil and v == nil then if r == nil and v == nil then
return nil, true return nil, true
end end
return r,v return r,v
end end
return f(s, cmd, x, y, ...) return f(s, cmd, x, y, px, py, ...)
end) end)
-- vim:ts=4 -- vim:ts=4