updated
This commit is contained in:
19
main.lua
19
main.lua
@@ -5,6 +5,7 @@ turbineVent = peripheral.find("turbineVent")
|
||||
monitor = peripheral.find("monitor")
|
||||
internalEnvironment = peripheral.wrap("environmentDetector_0")
|
||||
externalEnvironment = peripheral.wrap("environmentDetector_1")
|
||||
modem = peripheral.wrap("right")
|
||||
|
||||
tempDriver = kernel.addDriver("temperature_driver")
|
||||
coolantDriver = kernel.addDriver("coolant_driver")
|
||||
@@ -13,7 +14,7 @@ turbineDriver = kernel.addDriver("turbine_driver")
|
||||
burnRateDriver = kernel.addDriver("burnrate_driver")
|
||||
environmentDriver = kernel.addDriver("environment_driver")
|
||||
|
||||
|
||||
isErrorState = false
|
||||
reactorStatus = false
|
||||
|
||||
function setNewLine()
|
||||
@@ -79,7 +80,9 @@ local function shutDown()
|
||||
environmentDriver.shutDown)
|
||||
end
|
||||
|
||||
local function run()
|
||||
|
||||
|
||||
local function runSafe()
|
||||
while not reactor do
|
||||
print("Waiting for reactor signal...")
|
||||
sleep(1)
|
||||
@@ -100,10 +103,20 @@ local function run()
|
||||
-- print(index, value)
|
||||
-- read()
|
||||
-- end
|
||||
|
||||
parallel.waitForAll(runMonitors, runDisplay)
|
||||
end
|
||||
|
||||
local function run()
|
||||
local success, err = pcall(runSafe)
|
||||
if not success then
|
||||
monitor.setTextColor(colors.red)
|
||||
monitor.write("Error: " .. err)
|
||||
isErrorState = true
|
||||
modem.open(500)
|
||||
modem.transmit(500, 500, "Error: " .. err)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return { run = run }
|
||||
|
||||
Reference in New Issue
Block a user