Hotkeys working now
This commit is contained in:
@@ -19,15 +19,15 @@ function engio.move(action, xyz, facing)
|
||||
end
|
||||
|
||||
function cube.lookhotkeys(keys)
|
||||
keys:add("X", "Cube Hi", function () dprint("Cube Hi") end)
|
||||
keys:add("A", "Cube Bye", function () dprint("Cube Bye") end)
|
||||
keys:add("Y", "Cube Yo", function () dprint("Cube Yo") end)
|
||||
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)
|
||||
end
|
||||
|
||||
function sphere.lookhotkeys(keys)
|
||||
keys:add("X", "Sphere Hi", function () dprint("Sphere Hi") end)
|
||||
keys:add("A", "Sphere Bye", function () dprint("Sphere Bye") end)
|
||||
keys:add("Y", "Sphere Yo", function () dprint("Sphere Yo") end)
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -58,3 +58,19 @@ function engio.getlookat()
|
||||
return ""
|
||||
end
|
||||
|
||||
function engio.presshotkey(action)
|
||||
local class = tangible.getclass(tangible.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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user