updated
This commit is contained in:
@@ -1,15 +1,43 @@
|
||||
local function report(reactor)
|
||||
local maxValue = 100
|
||||
local minValue = 0
|
||||
|
||||
local function configureReport(monitor)
|
||||
local x,y = term.getCursorPos()
|
||||
monitor.setCursorPos(x, y + 1)
|
||||
monitor.clearLine()
|
||||
end
|
||||
|
||||
local function getValue(reactor)
|
||||
return (reactor.getCoolantFilledPercentage() or 0) * 100
|
||||
end
|
||||
|
||||
local function watch(reactor, monitor)
|
||||
local coolantLevel = getValue(reactor)
|
||||
print("Coolant: " .. coolantLevel)
|
||||
sleep(1)
|
||||
end
|
||||
|
||||
local function report(reactor, monitor)
|
||||
if reactor then
|
||||
return (reactor.getCoolantFilledPercentage() or 0) * 100
|
||||
local value = getValue(reactor)
|
||||
local color = color(reactor)
|
||||
configureReport(monitor)
|
||||
monitor.setBackgroundColor(color)
|
||||
monitor.write("Coolant: " .. value .. "%")
|
||||
else
|
||||
return "No reactor found"
|
||||
end
|
||||
end
|
||||
|
||||
local function watch(reactor, monitor)
|
||||
local coolantLevel =
|
||||
print("Coolant: " .. report(reactor))
|
||||
sleep(1)
|
||||
local function configureReport(monitor)
|
||||
local x,y = monitor.getCursorPos()
|
||||
monitor.setCursorPos(x, y + 1)
|
||||
monitor.clearLine()
|
||||
end
|
||||
|
||||
return { report = report, watch = watch }
|
||||
local function color(reactor)
|
||||
local coolantLevel = getValue(reactor)
|
||||
return colors.black
|
||||
end
|
||||
|
||||
return { report = report, watch = watch}
|
||||
Reference in New Issue
Block a user