Manual iris control
This commit is contained in:
38
handlers.lua
38
handlers.lua
@ -97,6 +97,40 @@ function handlers.handlePasswordInput()
|
||||
return password
|
||||
end
|
||||
|
||||
---------------------------------------------
|
||||
-- IRIS BUTTON HANDLER
|
||||
---------------------------------------------
|
||||
|
||||
function handlers.handleIrisButtons(eventType, side, x, y)
|
||||
-- Only process if not entering password (password handler has higher priority)
|
||||
if state.enteringPassword then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Only process if iris is enabled
|
||||
if not config.irisEnabled then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Check if clicking iris buttons (bottom-left area)
|
||||
if y >= 17 and y <= 19 then
|
||||
-- Open button (2-9)
|
||||
if x >= 2 and x <= 9 then
|
||||
utils.openIris()
|
||||
display.drawIrisStatus()
|
||||
return "iris_opened"
|
||||
end
|
||||
-- Close button (11-18)
|
||||
if x >= 11 and x <= 18 then
|
||||
utils.closeIris()
|
||||
display.drawIrisStatus()
|
||||
return "iris_closed"
|
||||
end
|
||||
end
|
||||
|
||||
return nil -- Not an iris button click
|
||||
end
|
||||
|
||||
---------------------------------------------
|
||||
-- DISCONNECT BUTTON HANDLER
|
||||
---------------------------------------------
|
||||
@ -169,6 +203,7 @@ end
|
||||
|
||||
function handlers.handleMessage(eventType, side, message)
|
||||
state.lastReceivedMessage = message
|
||||
utils.debug("Message Received: " .. message)
|
||||
return "message_received"
|
||||
end
|
||||
|
||||
@ -200,8 +235,9 @@ function handlers.setupConnectionHandlers()
|
||||
-- Clear any existing handlers
|
||||
events.clearHandlers()
|
||||
-- Register all handlers with their priorities
|
||||
events.registerHandler("monitor_touch", handlers.handleIrisButtons, events.PRIORITY.DISCONNECT_BUTTON) -- Same priority as disconnect
|
||||
events.registerHandler("monitor_touch", handlers.handleDisconnectButton, events.PRIORITY.DISCONNECT_BUTTON)
|
||||
events.registerHandler("monitor_touch", handlers.handleDefaultClick, events.PRIORITY.DEFAULT) -- Lowest priority - returns coordinates
|
||||
events.registerHandler("monitor_touch", handlers.handleDefaultClick, events.PRIORITY.DEFAULT) -- Lowest priority - returns coordinates
|
||||
events.registerHandler("stargate_incoming_wormhole", handlers.handleActivation, events.PRIORITY.ACTIVATION)
|
||||
events.registerHandler("stargate_reconstructing_entity", handlers.handleEntityRead, events.PRIORITY.ENTITY_READ)
|
||||
events.registerHandler("stargate_disconnected", handlers.handleDisconnect, events.PRIORITY.DISCONNECT_CHECK)
|
||||
|
||||
Reference in New Issue
Block a user