Fixed hotkey up/down handling

This commit is contained in:
2026-04-13 16:08:23 -04:00
parent 85a6fad139
commit f3d9a903d2
4 changed files with 58 additions and 96 deletions

View File

@@ -33,16 +33,16 @@ function moveto(x, y)
tangible.animate{tan=actor, anim={action="moveto", xyz={x, y, z}, facing=math.auto}}
end
function cube.lookhotkeys(keys)
keys:add("Z", "Cube Hi", function () dprint("Doing Cube Hi") end)
keys:add("X", "Cube Bye", function () dprint("Doing Cube Bye") end)
keys:add("C", "Cube Yo", function () dprint("Doing Cube Yo") end)
function cube.lookhotkeys(add)
add("Z", "Cube Hi", function () dprint("Doing Cube Hi") end)
add("X", "Cube Bye", function () dprint("Doing Cube Bye") end)
add("C", "Cube Yo", function () dprint("Doing Cube Yo") end)
end
function sphere.lookhotkeys(keys)
keys:add("Z", "Sphere Hi", function () dprint("Doing Sphere Hi") end)
keys:add("X", "Sphere Bye", function () dprint("Doing Sphere Bye") end)
keys:add("C", "Sphere Yo", function () dprint("Doing Sphere Yo") end)
function sphere.lookhotkeys(add)
add("Z", "Sphere Hi", function () dprint("Doing Sphere Hi") end)
add("X", "Sphere Bye", function () dprint("Doing Sphere Bye") end)
add("C", "Sphere Yo", function () dprint("Doing Sphere Yo") end)
end
@@ -69,35 +69,7 @@ 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)
-- if the tangible doesn't have a 'lookhotkeys' function, do nothing
if class == nil or class.lookhotkeys == nil then
return
end
local press = hotkeypress.create(action)
class.lookhotkeys(press)
local closure = press.closure
if closure ~= nil then
closure()
end
end
function jp3()
tangible.animate{tan=actor, anim={action="play", seq="jump"}}