refactor: replace hardcoded channel IDs with dynamic retrieval from platform.channels

This commit is contained in:
MayaTheShy
2026-03-26 15:22:51 -04:00
parent c4b9509b5c
commit bdf7a51675

View File

@@ -3,9 +3,11 @@
-- This script only handles: eval execution, status broadcasting,
-- GPS tracking, inventory/peripheral events.
local CHANNEL_RECEIVE = 100
local CHANNEL_SEND = 101
local STATUS_CHANNEL = 102
local Channels = require('platform.channels')
local CHANNEL_RECEIVE = Channels.get('remoteturtle.command')
local CHANNEL_SEND = Channels.get('remoteturtle.response')
local STATUS_CHANNEL = Channels.get('remoteturtle.status')
-- State tracking (lightweight - server drives everything)
local state = {
@@ -23,11 +25,13 @@ local config = {
}
-- Check for modem
local modem = peripheral.find("modem")
local WebBridge = require('platform.webbridge')
local modem, modemSide = WebBridge.findModem(true)
if not modem then
error("No wireless modem found!")
end
modem.open(CHANNEL_RECEIVE)
-- Open command channel (respects dual-mode migration)
WebBridge.openChannels(modem, { 'remoteturtle.command' })
print("Server-Driven Turtle v5 (Pure Eval Protocol)")
print("ID: " .. os.getComputerID())