Respond to iris opening quicker

This commit is contained in:
2026-01-02 00:24:27 -05:00
parent d11641693b
commit fd09b7fc3c
4 changed files with 26 additions and 10 deletions

View File

@ -49,9 +49,6 @@ config.chatboxDebugPlayer = "MoonlitJolty"
-- MESSAGING
---------------------------------------------
-- Program version (sent to remote gates when connection established)
config.programVersion = "1.0"
-- Enable computer-to-computer messaging through stargate
config.enableMessaging = true

View File

@ -82,8 +82,9 @@ function handlers.handlePasswordInput()
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
-- 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 +259,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"

View File

@ -11,6 +11,12 @@
- Whitelist/blacklist security
]]
---------------------------------------------
-- PROGRAM VERSION
---------------------------------------------
local PROGRAM_VERSION = "2.0"
---------------------------------------------
-- LOAD MODULES
---------------------------------------------
@ -461,8 +467,8 @@ local function handleIncomingWormhole()
-- Send version message to remote gate
sleep(0.5) -- Brief delay to ensure connection is stable
utils.sendVersionMessage()
utils.debug("Sent: SGCS_V" .. config.programVersion)
utils.sendVersionMessage(PROGRAM_VERSION)
utils.debug("Sent: SGCS_V" .. PROGRAM_VERSION)
-- Handle iris
if config.autoCloseIrisOnIncoming then
@ -753,6 +759,11 @@ local function handleOutgoingDial()
utils.log("Remote gate requires password for entry")
lastMessageTime = os.clock()
break -- Got password request, that's all we need
elseif message == "GDO_IRIS_OPEN" then
utils.log("Remote iris opened via GDO")
state.remotePasswordRequired = false
lastMessageTime = os.clock()
break -- Iris opened, no password needed
end
elseif result == 2 then
-- GDO transmission received (handled by event system)
@ -818,7 +829,7 @@ local function handleOutgoingDial()
if waitResult == 1 then
local response = state.lastReceivedMessage
state.lastReceivedMessage = nil
if response == "IRIS_OPEN" then
if response == "IRIS_OPEN" or response == "GDO_IRIS_OPEN" then
display.showPasswordResult(true)
utils.log("Password accepted - iris opened")
sleep(1)

View File

@ -163,9 +163,9 @@ end
-- MESSAGING
---------------------------------------------
function utils.sendVersionMessage()
function utils.sendVersionMessage(version)
if config.enableMessaging then
local message = "SGCS_V" .. config.programVersion
local message = "SGCS_V" .. version
gate.sendStargateMessage(message)
utils.log("Sent version message: " .. message)
return true