updated
This commit is contained in:
17
main.lua
17
main.lua
@@ -1,5 +1,6 @@
|
|||||||
local kernel = require("kernel")
|
local kernel = require("kernel")
|
||||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||||
|
local turbine = peripheral.find("turbineValve")
|
||||||
local monitor = peripheral.find("monitor")
|
local monitor = peripheral.find("monitor")
|
||||||
local tempDriver = kernel.addDriver("temperature_driver")
|
local tempDriver = kernel.addDriver("temperature_driver")
|
||||||
local coolantDriver = kernel.addDriver("coolant_driver")
|
local coolantDriver = kernel.addDriver("coolant_driver")
|
||||||
@@ -15,7 +16,7 @@ local function runMonitors()
|
|||||||
tempDriver.watch(reactor, monitor)
|
tempDriver.watch(reactor, monitor)
|
||||||
coolantDriver.watch(reactor, monitor)
|
coolantDriver.watch(reactor, monitor)
|
||||||
statusDriver.watch(reactor, monitor)
|
statusDriver.watch(reactor, monitor)
|
||||||
turbineDriver.watch(reactor, monitor)
|
turbineDriver.watch(turbine, monitor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -32,19 +33,29 @@ local function runDisplay()
|
|||||||
monitor.clear()
|
monitor.clear()
|
||||||
end
|
end
|
||||||
monitor.setCursorPos(1, 1)
|
monitor.setCursorPos(1, 1)
|
||||||
local drivers = {
|
local reactorDrivers = {
|
||||||
{ Label = "Status", driver = statusDriver },
|
{ Label = "Status", driver = statusDriver },
|
||||||
{ Label = "Temperature", driver = tempDriver },
|
{ Label = "Temperature", driver = tempDriver },
|
||||||
{ Label = "Coolant", driver = coolantDriver },
|
{ Label = "Coolant", driver = coolantDriver },
|
||||||
{ Label = "Turbine", driver = turbineDriver },
|
{ Label = "Turbine", driver = turbineDriver },
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, item in ipairs(drivers) do
|
for i, item in ipairs(reactorDrivers) do
|
||||||
monitor.setCursorPos(1, i)
|
monitor.setCursorPos(1, i)
|
||||||
item.driver.report(reactor, monitor)
|
item.driver.report(reactor, monitor)
|
||||||
monitor.setCursorPos(1, i + 1)
|
monitor.setCursorPos(1, i + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local turbineDrivers = {
|
||||||
|
{ Label = "Turbine", driver = turbineDriver }
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, item in ipairs(turbineDrivers) do
|
||||||
|
monitor.setCursorPos(1, i)
|
||||||
|
item.driver.report(turbine, monitor)
|
||||||
|
monitor.setCursorPos(1, i + 1)
|
||||||
|
end
|
||||||
|
|
||||||
sleep(0.25) -- Update every quarter second
|
sleep(0.25) -- Update every quarter second
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
local function getValue(reactor)
|
local function getValue(target)
|
||||||
return reactor.getSteamFilledPercentage() * 100
|
return target.getSteamFilledPercentage() * 100
|
||||||
end
|
end
|
||||||
|
|
||||||
local function color(reactor)
|
local function color(target)
|
||||||
local value = getValue(reactor)
|
local value = getValue(target)
|
||||||
return colors.black
|
return colors.black
|
||||||
end
|
end
|
||||||
|
|
||||||
local function watch(reactor, monitor)
|
local function watch(target, monitor)
|
||||||
print("Turbine Steam Filled: " .. getValue(reactor))
|
print("Turbine Steam Filled: " .. getValue(target))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function report(reactor, monitor)
|
local function report(target, monitor)
|
||||||
local color = color(reactor)
|
local color = color(target)
|
||||||
monitor.setBackgroundColor(color)
|
monitor.setBackgroundColor(color)
|
||||||
monitor.clearLine()
|
monitor.clearLine()
|
||||||
monitor.write("Turbine Steam Filled: " .. getValue(reactor) .. "%")
|
monitor.write("Turbine Steam Filled: " .. getValue(target) .. "%")
|
||||||
end
|
end
|
||||||
return { report = report, watch = watch }
|
return { report = report, watch = watch }
|
||||||
Reference in New Issue
Block a user