updated
This commit is contained in:
@@ -1,10 +1,16 @@
|
|||||||
local function report()
|
local function report(reactor)
|
||||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
|
||||||
if reactor then
|
if reactor then
|
||||||
return reactor.getTemperature()
|
return reactor.getCoolantFilledPercentage()
|
||||||
else
|
else
|
||||||
return "No reactor found"
|
return "No reactor found"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return { report = report }
|
local function watch(reactor, monitor)
|
||||||
|
while true do
|
||||||
|
print("Coolant: " .. report(reactor))
|
||||||
|
sleep(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return { report = report, watch = watch }
|
||||||
6
main.lua
6
main.lua
@@ -1,15 +1,19 @@
|
|||||||
local function run()
|
local function run()
|
||||||
local kernel = require("kernel")
|
local kernel = require("kernel")
|
||||||
local tempDriver = kernel.addDriver("temperature_driver")
|
local tempDriver = kernel.addDriver("temperature_driver")
|
||||||
|
local coolantDriver = kernel.addDriver("coolant_driver")
|
||||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||||
local monitor = peripheral.find("monitor")
|
local monitor = peripheral.find("monitor")
|
||||||
while true do
|
while true do
|
||||||
monitor.clear()
|
monitor.clear()
|
||||||
monitor.setCursorPos(1,1)
|
monitor.setCursorPos(1,1)
|
||||||
|
|
||||||
|
tempDriver.watch(reactor, monitor)
|
||||||
|
coolantDriver.watch(reactor, monitor)
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
{ Label = "Temperature", value = tempDriver.report(reactor)},
|
{ Label = "Temperature", value = tempDriver.report(reactor)},
|
||||||
{ Label = "Pressure", value = "101kPa" },
|
{ Label = "Coolant", value = coolantDriver.report(reactor) },
|
||||||
{ Label = "Humidity", value = "45%" }
|
{ Label = "Humidity", value = "45%" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,4 +6,11 @@ local function report(reactor)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return { report = report }
|
local function watch(reactor, monitor)
|
||||||
|
while true do
|
||||||
|
print("Temperature: " .. report(reactor))
|
||||||
|
sleep(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return { report = report, watch = watch }
|
||||||
Reference in New Issue
Block a user