entirely rework event handling take 4

This commit is contained in:
2025-12-29 01:26:16 -05:00
parent c5413a378b
commit a6fa42e924
2 changed files with 15 additions and 10 deletions

View File

@ -40,7 +40,7 @@ end
function handlers.handleDefaultClick(eventType, side, x, y)
-- Default handler that returns click coordinates
-- This has the lowest priority, so other handlers can intercept first
return {x = x, y = y}
return { x = x, y = y }
end
---------------------------------------------
@ -110,6 +110,9 @@ function handlers.handlePasswordInput()
-- Unregister the password handler
events.clearHandlers("monitor_touch")
-- Re-register connection handlers after password entry completes
handlers.setupConnectionHandlers()
-- Send password attempt
utils.sendPasswordAttempt(password)
@ -190,12 +193,13 @@ end
function handlers.setupConnectionHandlers()
-- Clear any existing handlers
events.clearHandlers()
-- Register all handlers with their priorities
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)
events.registerHandler("stargate_message_received", handlers.handleMessage, events.PRIORITY.MESSAGE)
endreturn handlers
end
return handlers