hotkeys module added
This commit is contained in:
parent
5f17afc295
commit
c7b2a1b5eb
|
@ -23,7 +23,7 @@ install:
|
||||||
$(INSTALL) quotes.lua $(STEADPATH)/quotes.lua
|
$(INSTALL) quotes.lua $(STEADPATH)/quotes.lua
|
||||||
$(INSTALL) timer.lua $(STEADPATH)/timer.lua
|
$(INSTALL) timer.lua $(STEADPATH)/timer.lua
|
||||||
$(INSTALL) kbd.lua $(STEADPATH)/kbd.lua
|
$(INSTALL) kbd.lua $(STEADPATH)/kbd.lua
|
||||||
|
$(INSTALL) hotkeys.lua $(STEADPATH)/hotkeys.lua
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(RM) $(STEADPATH)/stead.lua
|
$(RM) $(STEADPATH)/stead.lua
|
||||||
|
|
|
@ -20,4 +20,5 @@ install:
|
||||||
copy dash.lua ..\bin\stead
|
copy dash.lua ..\bin\stead
|
||||||
copy timer.lua ..\bin\stead
|
copy timer.lua ..\bin\stead
|
||||||
copy kbd.lua ..\bin\stead
|
copy kbd.lua ..\bin\stead
|
||||||
|
copy hotkeys.lua ..\bin\stead
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,9 @@ go = function (self, where, back)
|
||||||
elseif here().__visited == nil then
|
elseif here().__visited == nil then
|
||||||
ref(to).__visited = 1
|
ref(to).__visited = 1
|
||||||
end
|
end
|
||||||
|
if isDialog(ref(to)) then
|
||||||
|
dialog_rescan(ref(to))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
PLAYER_MOVED = true
|
PLAYER_MOVED = true
|
||||||
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
|
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
|
||||||
|
|
18
stead/hotkeys.lua
Normal file
18
stead/hotkeys.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'kbd'
|
||||||
|
|
||||||
|
stead.module_init(function()
|
||||||
|
hook_keys('1','2','3','4','5','6','7','8','9','0');
|
||||||
|
end)
|
||||||
|
|
||||||
|
game.kbd = stead.hook(game.kbd, function(f, s, down, key, ...)
|
||||||
|
if down and key >= '0' and key <= '9' then
|
||||||
|
if isDialog(here()) then
|
||||||
|
local p = seen(key);
|
||||||
|
if p then
|
||||||
|
return call(p, 'act');
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return f(s, down, key, unpack(arg));
|
||||||
|
end)
|
|
@ -21,6 +21,13 @@ input.key = stead.hook(input.key, function(f, s, down, key, ...)
|
||||||
return f(s, down, key, unpack(arg))
|
return f(s, down, key, unpack(arg))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
function hook_keys(...)
|
||||||
|
local i
|
||||||
|
for i = 1, stead.table.maxn(arg) do
|
||||||
|
stead.table.insert(input.key_hooks, tostring(arg[i]));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
stead.module_init(function()
|
stead.module_init(function()
|
||||||
input.key_hooks = {}
|
input.key_hooks = {}
|
||||||
end)
|
end)
|
||||||
|
|
Reference in a new issue