First step in redesigning lua widgets

This commit is contained in:
2026-04-09 14:43:11 -04:00
parent 6be07679d2
commit 3b6207f7a1
6 changed files with 62 additions and 73 deletions

View File

@@ -55,13 +55,9 @@ function engio.getlookat()
end
-- if the class has a function 'lookhotkeys', then the correct
-- look-at widget is 'hotkeys'. We're going to automatically
-- generate the correct response.
-- look-at widget is 'hotkeys'.
if class.lookhotkeys ~= nil then
local keys = hotkeylist.create()
class.lookhotkeys(keys)
setmetatable(keys, nil)
return keys
return "hotkeys"
end
-- otherwise, if the class has a function 'getlookat', use that.
@@ -73,6 +69,20 @@ function engio.getlookat()
return ""
end
function engio.gethotkeys()
local class = tangible.getclass(place)
-- if the tangible doesn't have a 'lookhotkeys' function, do nothing
if class == nil or class.lookhotkeys == nil then
return {}
end
local keys = hotkeylist.create()
class.lookhotkeys(keys)
setmetatable(keys, nil)
return keys
end
function engio.presshotkey(action)
local class = tangible.getclass(place)
@@ -94,4 +104,4 @@ function jp3()
tangible.animate{tan=actor, anim={action="play", seq="jump"}}
tangible.animate{tan=actor, anim={action="play", seq="jump"}}
end