local config = dofile("/etc/rscr.lua")
+do
+ if config then
+ print("Current config:")
+ term.setTextColor(colors.lightGray)
+ print(textutils.serialize(config))
+ term.setTextColor(colors.white)
+ else
+ print("No config found")
+ return false
+ end
+end
+
local modem
do
local m
end
if m then
modem = peripheral.getName(m)
+ print("Modem found: "..modem)
peripheral.call(modem, "open", config.controller_port)
+ term.setTextColor(colors.lightGray)
+ print(" listening on port "..tostring(config.controller_port))
+ term.setTextColor(colors.white)
else
print("No modem connected")
return false
end
if sc then
speed_controller = peripheral.getName(sc)
+ print("Rotation speed controller found: "..speed_controller)
else
print("No rotation speed controller connected")
return false
end
if sm then
stressometer = peripheral.getName(sm)
+ print("Stressometer found: "..stressometer)
else
print("No stressometer connected, limited functionality")
end
end
+local chatbox
+do
+ local cb
+ if config.chatbox ~= nil then
+ cb = peripheral.wrap(config.chatbox)
+ else
+ cb = peripheral.find("chatBox")
+ end
+ if cb then
+ chatbox = peripheral.getName(cb)
+ print("Chatbox found: "..chatbox)
+ else
+ print("No chatbox connected, limited functionality")
+ end
+end
+
local transmit = function(payload)
peripheral.call(modem, "transmit", config.remote_port, config.controller_port, textutils.serialize(payload, { compact = true }))
end
return update_remotes()
end
+term.setTextColor(colors.green)
+print("Controller online")
+term.setTextColor(colors.white)
+
parallel.waitForAny(receive, update_remotes)
-- listens for modem messages from controller
local config = dofile("/etc/rscr.lua")
+do
+ if config then
+ print("Current config:")
+ term.setTextColor(colors.lightGray)
+ print(textutils.serialize(config))
+ term.setTextColor(colors.white)
+ else
+ print("No config found!")
+ return false
+ end
+end
local modem
do
end
if m then
modem = peripheral.getName(m)
+ print("Modem found: "..modem)
peripheral.call(modem, "open", config.remote_port)
+ term.setTextColor(colors.lightGray)
+ print(" listening on port "..tostring(config.remote_port))
+ term.setTextColor(colors.white)
else
print("No modem connected")
return false
end
if m then
monitor = peripheral.getName(m)
+ print("Monitor found: "..monitor)
peripheral.call(monitor, "setTextScale", 0.5)
else
print("No advanced monitor connected")
peripheral.call(monitor, "clear")
end
+term.setTextColor(colors.green)
+print("Remote online")
+term.setTextColor(colors.white)
+
draw()
transmit({ connect = true })
parallel.waitForAny(on_terminate, touch_screen, receive)