/usr/share/games/instead/stead/click.lua is in instead-data 1.9.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | require "theme"
click = {
nam = 'click';
object_type = true;
system_type = true;
bg = false;
press = false;
button = false;
save = function(self, name, h, need)
local s = stead.tostring(self.bg)
h:write(stead.string.format("click[%q] = %s;\n", 'bg', s))
s = stead.tostring(self.press)
h:write(stead.string.format("click[%q] = %s;\n", 'press', s))
s = stead.tostring(self.button)
h:write(stead.string.format("click[%q] = %s;\n", 'button', s))
end;
}
stead.module_init(function()
input.click = stead.hook(input.click,
function(f, s, press, mb, x, y, px, py, ...)
local cmd = 'click '
local act = false
if ( press or click.press ) and ( mb == 1 or click.button ) then
cmd = cmd..tostring(press)..','..tostring(mb);
if click.bg or theme.get 'scr.gfx.mode' == 'direct' then
act = true
cmd = cmd .. ',' .. x .. ','.. y
end
if px then
act = true
cmd = cmd .. ',' .. px .. ',' .. py
end
if act then
return cmd
end
end
return f(s, press, mb, x, y, px, py, ...)
end)
end)
game.action = stead.hook(game.action,
function(f, s, cmd, press, mb, x, y, px, py, ...)
if cmd == 'click' then
local r,v
local x2 = px
local y2 = py
if tonumber(mb) then
mb = tonumber(mb)
end
if tonumber(px) then
x2 = tonumber(px)
end
if tonumber(py) then
y2 = tonumber(py)
end
if stead.here().click then
s = stead.here()
end
if press == 'true' then
press = true
else
press = false
end
if s.click then
if click.press then
if click.button then
r,v = stead.call(s, 'click', press, mb, tonumber(x), tonumber(y), x2, y2, ...);
else
r,v = stead.call(s, 'click', press, tonumber(x), tonumber(y), x2, y2, ...);
end
else
if click.button then
r,v = stead.call(s, 'click', mb, tonumber(x), tonumber(y), x2, y2, ...);
else
r,v = stead.call(s, 'click', tonumber(x), tonumber(y), x2, y2, ...);
end
end
end
if r == nil and v == nil and stead.api_version < "1.3.5" then
return nil, true
end
return r,v
end
return f(s, cmd, x, y, px, py, ...)
end)
-- vim:ts=4
|