From 3679c69022f4462d0b42e1266778900170d1fe04 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Mon, 7 Jun 2010 13:53:00 +0000 Subject: [PATCH] click module --- debian/changelog | 2 +- stead/Makefile | 1 + stead/Makefile.windows | 1 + stead/click.lua | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 stead/click.lua diff --git a/debian/changelog b/debian/changelog index 351f44c..68731bc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,7 +11,7 @@ instead (1.2.0) unstable; urgency=low * hook and inherit; * entered/left human friendly actions; * stead.cmd, stead.args added; - * require added (module goto); + * require added (modules: goto, xobj, input, click); * aligned width for themes/games dialog; -- Peter Kosyh Tue, 01 Jun 2010 17:40:00 +0300 diff --git a/stead/Makefile b/stead/Makefile index 5d6b352..deb7965 100644 --- a/stead/Makefile +++ b/stead/Makefile @@ -11,6 +11,7 @@ install: $(INSTALL) goto.lua $(STEADPATH)/goto.lua $(INSTALL) xobj.lua $(STEADPATH)/xobj.lua $(INSTALL) input.lua $(STEADPATH)/input.lua + $(INSTALL) click.lua $(STEADPATH)/click.lua uninstall: $(RM) $(STEADPATH)/stead.lua diff --git a/stead/Makefile.windows b/stead/Makefile.windows index 7377fbd..a2b8498 100644 --- a/stead/Makefile.windows +++ b/stead/Makefile.windows @@ -8,3 +8,4 @@ install: copy goto.lua ..\bin\stead copy xobj.lua ..\bin\stead copy input.lua ..\bin\stead + copy click.lua ..\bin\stead diff --git a/stead/click.lua b/stead/click.lua new file mode 100644 index 0000000..7c7ae20 --- /dev/null +++ b/stead/click.lua @@ -0,0 +1,14 @@ +input.click = function(s, press, mb, x, y, px, py) + if press and px then + return "click "..px..','..py; + end +end + +game.action = hook(game.action, +function(f, s, cmd, x, y, ...) + if cmd == 'click' then + return call(here(), 'click', x, y); + end + if f then return f(s, cmd, x, y, unpack(arg)) end +end) +