Respond to iris opening quicker

This commit is contained in:
2026-01-02 00:24:27 -05:00
parent d11641693b
commit 5740ef34c6
4 changed files with 50 additions and 13 deletions

View File

@ -64,7 +64,7 @@ function handlers.handlePasswordInput()
local remoteIrisState = transceiver.checkConnectedShielding()
if not remoteIrisState or remoteIrisState == 0 then
-- Iris opened! Exit password prompt
utils.log("Remote iris opened, canceling password prompt")
utils.log("Remote iris opened via transceiver check, canceling password prompt")
state.enteringPassword = false
return "IRIS_OPENED"
end
@ -74,16 +74,21 @@ function handlers.handlePasswordInput()
local event = { os.pullEvent() }
local eventType = event[1]
utils.log("DEBUG: Password handler received event: " .. tostring(eventType))
-- Handle GDO events
if eventType == "transceiver_transmission_received" then
-- Pass to GDO handler
utils.log("DEBUG: Processing GDO transmission in password handler")
handlers.handleGDOTransmission(table.unpack(event))
-- Continue loop to check iris state
elseif eventType == "stargate_message_received" then
-- Pass to message handler
handlers.handleMessage(table.unpack(event))
-- Check if iris opened
if state.lastReceivedMessage == "IRIS_OPEN" then
utils.log("DEBUG: Message in password handler: " .. tostring(state.lastReceivedMessage))
-- Check if iris opened (via password or GDO)
if state.lastReceivedMessage == "IRIS_OPEN" or state.lastReceivedMessage == "GDO_IRIS_OPEN" then
utils.log("Received iris open confirmation: " .. state.lastReceivedMessage)
state.lastReceivedMessage = nil
state.enteringPassword = false
return "IRIS_OPENED"
@ -258,6 +263,13 @@ function handlers.handleGDOTransmission(eventType, side, frequency, idc, matches
utils.log("Valid GDO code received - opening iris")
utils.debug("Valid GDO - opening iris")
utils.openIris()
-- Send message to remote gate that iris opened via GDO
if config.enableMessaging then
gate.sendStargateMessage("GDO_IRIS_OPEN")
utils.log("Sent GDO iris open notification to remote gate")
utils.debug("Sent: GDO_IRIS_OPEN")
end
end
return "gdo_received"