Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --modpack configs
- reactorOutputMultiplier = 1.0
- reactorFuelUsageMultiplier = 1.0
- --program configs (multiplied by the reactor output multiplier and divided by core volume)
- maxIOsmoothing = 888 * reactorOutputMultiplier
- IOlimitingMaxOUT = 5200000 * reactorOutputMultiplier
- IOlimitingMinIN = 1500000 * reactorOutputMultiplier
- --Do not change anything below!!!!!!!
- --Functions
- function toggle(boolean)
- if boolean == 1 then
- return 0
- else
- return 1
- end
- end
- function energyCoreFullWarning()
- gWrite("! ATTENTION !", corePosX-5, corePosY-1, colors.white, coreColor)
- gWrite("ENERGY CORE FULL!", corePosX-7, corePosY, colors.white, coreColor)
- gWrite("LOCKING IO SMOOTH", corePosX-7, corePosY+1, colors.white, coreColor)
- gWrite("TO AVOID OVERLOAD", corePosX-7, corePosY+2, colors.white, coreColor)
- end
- function fuelConversionWarning()
- gWrite("! ATTENTION !", corePosX-5, corePosY-1, colors.white, coreColor)
- gWrite("FUEL CONVERSION", corePosX-7, corePosY, colors.white, coreColor)
- gWrite("ABOVE SET LIMITS!", corePosX-7, corePosY+1, colors.white, coreColor)
- gWrite("SHUTTING DOWN...", corePosX-7, corePosY+2, colors.white, coreColor)
- end
- function powerOutputWarning()
- gWrite("!! WARNING !!", corePosX-5, corePosY-1, colors.white, coreColor)
- gWrite("INSUFFICIENT", corePosX-7, corePosY, colors.white, coreColor)
- gWrite("OUTPUT FOR SELF-", corePosX-7, corePosY+1, colors.white, coreColor)
- gWrite("SUSTAINABILITY", corePosX-7, corePosY+2, colors.white, coreColor)
- end
- function reactorBoomWarning()
- gWrite("!! DANGER !!", corePosX-5, corePosY-1, colors.white, coreColor)
- gWrite("CORE DESTABILIZED", corePosX-7, corePosY, colors.white, coreColor)
- gWrite("!! EXPLOSION !!", corePosX-7, corePosY+1, colors.white, coreColor)
- gWrite("!! IMMINENT !!", corePosX-7, corePosY+2, colors.white, coreColor)
- end
- --chatgeepeetee moment
- function secondsToTimeString(seconds)
- local days = math.floor(seconds / (24 * 3600))
- local hours = math.floor((seconds % (24 * 3600)) / 3600)
- local minutes = math.floor((seconds % 3600) / 60)
- local remainingSeconds = math.floor(seconds % 60)
- local formattedTime = string.format("%sd %sh %sm %ss", days, hours, minutes, remainingSeconds)
- return formattedTime
- end
- function secondsToTimeStringExtended(seconds)
- local years = math.floor(seconds / (365 * 24 * 3600))
- local days = math.floor((seconds % (365 * 24 * 3600)) / (24 * 3600))
- local hours = math.floor((seconds % (24 * 3600)) / 3600)
- local minutes = math.floor((seconds % 3600) / 60)
- local remainingSeconds = math.floor(seconds % 60)
- local formattedTime = string.format("%sy %sd %sh %sm %ss", years, days, hours, minutes, remainingSeconds)
- return formattedTime
- end
- --save/load config functions
- function saveConfig()
- config = fs.open("config.txt", "w")
- config.writeLine(tempTarget)
- config.writeLine(fieldTarget)
- config.writeLine(saturationTarget)
- config.writeLine(fuelUseRateTarget)
- config.writeLine(conversionTarget)
- config.writeLine(targetPowerOutput)
- config.writeLine(fastStartup)
- config.writeLine(safetySystems)
- config.writeLine(onePointTwelveMode)
- config.writeLine(controlSelected)
- config.writeLine(saturationSafetyOverride)
- config.writeLine(scriptInitialized)
- config.writeLine(controlsLocked)
- config.writeLine(ioLocked)
- config.writeLine(powerOutputUpdated)
- config.writeLine(powerInputUpdated)
- config.writeLine(ioSmoothing)
- config.writeLine(IOlimiting)
- config.close()
- end
- function loadConfig()
- config = fs.open("config.txt", "r")
- tempTarget = tonumber(config.readLine())
- fieldTarget = tonumber(config.readLine())
- saturationTarget = tonumber(config.readLine())
- fuelUseRateTarget = tonumber(config.readLine())
- conversionTarget = tonumber(config.readLine())
- targetPowerOutput = tonumber(config.readLine())
- fastStartup = tonumber(config.readLine())
- safetySystems = tonumber(config.readLine())
- onePointTwelveMode = tonumber(config.readLine())
- controlSelected = tonumber(config.readLine())
- saturationSafetyOverride = tonumber(config.readLine())
- scriptInitialized = tonumber(config.readLine())
- controlsLocked = tonumber(config.readLine())
- ioLocked = tonumber(config.readLine())
- powerOutputUpdated = tonumber(config.readLine())
- powerInputUpdated = tonumber(config.readLine())
- ioSmoothing = tonumber(config.readLine())
- IOlimiting = tonumber(config.readLine())
- config.close()
- end
- --periphSearch function by https://github.com/acidjazz/drmon/blob/master/drmon.lua
- function periphSearch(type)
- local names = peripheral.getNames()
- local i, name
- for i, name in pairs(names) do
- if peripheral.getType(name) == type then
- return peripheral.wrap(name)
- end
- end
- return null
- end
- --graphics functions
- function gWrite(text, x, y, cl, clBg)
- mon.monitor.setCursorPos(x, y)
- mon.monitor.setTextColor(cl)
- mon.monitor.setBackgroundColor(clBg)
- mon.monitor.write(text)
- end
- function gWriteTextOnly(text, x, y, cl, lmt)
- mon.monitor.setCursorPos(x, y)
- mon.monitor.setTextColor(cl)
- for tl = 0,string.len(text),1 do
- letter = string.sub(text,tl,tl)
- clBg = mon.monitor.getBackgroundColor()
- if tl > lmt then
- clBg = colors.gray
- end
- mon.monitor.setBackgroundColor(clBg)
- mon.monitor.write(letter)
- end
- end
- function gWriteR(text, x, y, cl, clBg)
- gWrite(text, mon.x - string.len(tostring(text)) - x, y, cl, clBg)
- end
- function gClear()
- mon.monitor.setBackgroundColor(colors.black)
- mon.monitor.clear()
- mon.monitor.setCursorPos(1,1)
- end
- function gWriteLR(textL, textR, xL, xR, y, clL, clR, clBg)
- gWrite(textL, xL, y, clL, clBg)
- gWriteR(textR, xR, y, clR, clBg)
- end
- function gDrawLine(x, y, length, cl)
- if length < 0 then
- return
- end
- mon.monitor.setCursorPos(x, y)
- if cl ~= nil then
- mon.monitor.setBackgroundColor(cl)
- end
- mon.monitor.write(string.rep(" ", length))
- end
- function gDrawProgressBar(x, y, length, proportion, cl, clBg)
- if proportion < 0.0 or proportion > 1.0 then
- gDrawLine(x, y, length, cl)
- else
- gDrawLine(x, y, length, clBg)
- gDrawLine(x, y, math.floor(proportion*length), cl)
- end
- end
- function gDrawStandardProgressBar(y, proportion, cl)
- gDrawProgressBar(2, y, mon.x-2, proportion, cl, colors.gray)
- end
- --initialization function
- function initialize()
- --connect machines
- energy_core = periphSearch("draconic_rf_storage")
- reactor = periphSearch("draconic_reactor")
- inputGate = periphSearch("flow_gate")
- outputGate = peripheral.wrap("top")
- --detect if they are null and give a valid error message
- if reactor == null then
- error("No valid reactor was found!")
- end
- if inputGate == null then
- error("No input flux gate was found!")
- end
- if outputGate == null then
- error("No output flux gate was found!")
- end
- if energy_core == null then
- print("No energy core was found. Skipping.")
- end
- inputGate.setOverrideEnabled(true)
- outputGate.setOverrideEnabled(true)
- end
- function temperatureControlSelected()
- targetTemp50 = math.min((tempTarget / 10000) * 50, 99)
- convLVL = (info.fuelConversion / info.maxFuelConversion * 1.3) - 0.3
- targetTempResist = ((targetTemp50^4) / (100 - targetTemp50))
- targetTempExpo = -(targetTempResist*convLVL) - 1000*convLVL + targetTempResist
- term1 = 1334.1-(3*targetTempExpo)
- term2 = (1200690-(2700*targetTempExpo))^2
- term3 = ((-1350*targetTempExpo)+(((-4*term1^3+term2)^(1/2))/2)+600345)^(1/3)
- targetNegCSat = -(term1/(3*term3))-(term3/3)
- targetCoreSat = 1 - (targetNegCSat/99)
- targetSat = targetCoreSat * info.maxEnergySaturation
- if controlSelected == 2 then
- targetSat = saturationTarget
- end
- saturationError = info.energySaturation - targetSat
- powerOutput = (math.min(saturationError, (info.maxEnergySaturation/40)) + info.generationRate)
- if powerOutput < 0 then
- powerOutput = 0
- end
- targetPowerOutput = powerOutput
- tempDrainFactor = 0
- if tempTarget > 8000 then
- tempDrainFactor = 1 + ((tempTarget-8000)^2 * 0.0000025)
- elseif tempTarget> 2000 then
- tempDrainFactor = 1
- elseif tempTarget > 1000 then
- tempDrainFactor = (tempTarget-1000)/1000
- end
- fuelUseRateTarget = (tempDrainFactor*(1D-targetSat/info.maxEnergySaturation)*(0.005)*1000000)*reactorFuelUsageMultiplier
- saturationTarget = targetSat
- end
- function saturationControlSelected()
- coreSat = saturationTarget / info.maxEnergySaturation
- fuelUseRateTarget = (tempDrainFactor*(1D-coreSat)*(0.005)*1000000)*reactorFuelUsageMultiplier
- saturationError = info.energySaturation - saturationTarget
- powerOutput = (math.min(saturationError, (info.maxEnergySaturation/40)) + info.generationRate)
- if powerOutput < 0 then
- powerOutput = 0
- end
- targetPowerOutput = powerOutput
- tempTarget = info.temperature
- end
- function conversionRateControlSelected()
- end
- function powerOutputControlSelected()
- powerOutput = targetPowerOutput
- fuelUseRateTarget = fuelUseRate
- saturationTarget = info.energySaturation
- tempTarget = info.temperature
- end
- --Always runs every time when the script starts
- if fs.exists("config.txt") then
- print("Loading config...")
- loadConfig()
- print("Done!")
- else
- print("Creating config...")
- tempTarget = 8000
- fieldTarget = 20
- fastStartup = 0
- safetySystems = 1
- onePointTwelveMode = 0
- saturationTarget = 11.33
- fuelUseRateTarget = 4433
- conversionTarget = 85
- targetPowerOutput = 3797871
- controlSelected = 0
- saturationSafetyOverride = 0
- scriptInitialized = 0
- controlsLocked = 0
- ioLocked = 0
- powerOutputUpdated = 0
- powerInputUpdated = 0
- ioSmoothing = 0
- IOlimiting = 0
- scriptFPS = 0
- saveConfig()
- print("Done!")
- end
- explosionTextState = 0
- configScreenSelected = false
- prevSat = 69420
- prevTime = os.epoch("utc")
- fpscooldown = 10
- messageCooldown = 0
- currentTableValue = 1
- energyStored = 6942069420
- prevEnergyStored = 0
- --initial monitor setup
- tmpMon = periphSearch("monitor")
- if tmpMon == null then
- error("No monitor was found")
- end
- if scriptInitialized == 1 then
- initialize()
- end
- --Runs every tick no matter what
- function update()
- while true do
- monX, monY = tmpMon.getSize()
- mon = {}
- mon.monitor, mon.x, mon.y = tmpMon, monX, monY
- fpscooldown = fpscooldown + 1
- if fpscooldown >= 10 then
- currentTime = os.epoch("utc")
- scriptFPS = 10000/(currentTime - prevTime)
- fpscooldown = 0
- end
- if scriptFPS == nil then
- scriptFPS = 0
- end
- prevTime = currentTime
- if scriptFPS > 15 then
- fpsColor = colors.lime
- elseif scriptFPS > 13 then
- fpsColor = colors.yellow
- elseif scriptFPS > 8 then
- fpsColor = colors.orange
- else
- fpsColor = colors.red
- end
- if controlsLocked ~= 1 then
- bottomBarColor = colors.lightGray
- else
- bottomBarColor = colors.gray
- end
- if scriptInitialized == 1 then
- main()
- if configScreenSelected == true then
- configScreen()
- else
- controlScreen()
- end
- else
- configScreenSelected = true
- configScreen()
- gWrite("INITIALIZE SCRIPT", 8, 17, colors.white, colors.purple)
- end
- if powerOutput ~= powerOutput then
- powerOutput = 0
- end
- saveConfig()
- sleep()
- end
- end
- --The function that detects if the monitor has been touched and then runs
- function updateMon()
- while true do
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- if configScreenSelected == true then
- --runs if config screen is selected and the monitor has been touched
- if yPos == 2 and xPos >= 15 and xPos <= 16 then
- onePointTwelveMode = toggle(onePointTwelveMode)
- elseif yPos == 3 and xPos >= 16 and xPos <= 17 then
- fastStartup = toggle(fastStartup)
- elseif yPos == 4 and xPos >= 18 and xPos <= 19 then
- safetySystems = toggle(safetySystems)
- elseif yPos == 5 and xPos >= 24 and xPos <= 25 then
- saturationSafetyOverride = toggle(saturationSafetyOverride)
- elseif yPos == 6 and xPos >= 16 and xPos <= 17 then
- IOlimiting = toggle(IOlimiting)
- end
- if scriptInitialized == 1 then
- if yPos == 17 and xPos >= 8 and xPos <= 13 then
- configScreenSelected = false
- end
- else
- if yPos == 17 and xPos >= 8 and xPos <= 24 then
- scriptInitialized = 1
- configScreenSelected = false
- initialize()
- end
- end
- else
- --runs if config screen is NOT selected and the monitor has been touched
- if yPos == 17 and xPos == 1 then
- controlsLocked = toggle(controlsLocked)
- end
- if controlsLocked ~= 1 then
- if yPos == 4 and xPos == 2 then
- tempTarget = tempTarget - 1.0
- controlSelected = 0
- prevLowestSatSubtractor = 20000
- elseif yPos == 4 and xPos >= 4 and xPos <= 5 then
- tempTarget = tempTarget - 10.0
- controlSelected = 0
- prevLowestSatSubtractor = 200000
- elseif yPos == 4 and xPos >= 7 and xPos <= 9 then
- tempTarget = tempTarget - 100.0
- controlSelected = 0
- prevLowestSatSubtractor = 2000000
- elseif yPos == 4 and xPos >= 11 and xPos <= 13 then
- tempTarget = tempTarget + 100.0
- controlSelected = 0
- prevLowestSatSubtractor = 20000
- elseif yPos == 4 and xPos >= 15 and xPos <= 16 then
- tempTarget = tempTarget + 10.0
- controlSelected = 0
- prevLowestSatSubtractor = 20000
- elseif yPos == 4 and xPos == 18 then
- tempTarget = tempTarget + 1.0
- controlSelected = 0
- prevLowestSatSubtractor = 20000
- end
- if controlSelected == 0 then
- tempTarget = math.floor(tempTarget*1.0)/1.0
- if tempTarget < 2000 then
- tempTarget = 2000
- end
- end
- if fieldTarget <= 10 then
- fieldTargetSetDivider = 10
- else
- fieldTargetSetDivider = 1
- end
- if fieldTarget <= 9.999 then
- fieldTargetSetDivider2 = 10
- else
- fieldTargetSetDivider2 = 1
- end
- if yPos == 9 and xPos == 2 then
- fieldTarget = fieldTarget - 0.099/fieldTargetSetDivider
- elseif yPos == 9 and xPos >= 4 and xPos <= 5 then
- fieldTarget = fieldTarget - 0.999/fieldTargetSetDivider
- elseif yPos == 9 and xPos >= 7 and xPos <= 9 then
- fieldTarget = fieldTarget - 9.999/fieldTargetSetDivider
- elseif yPos == 9 and xPos >= 11 and xPos <= 13 then
- fieldTarget = fieldTarget + 10.001/fieldTargetSetDivider2
- elseif yPos == 9 and xPos >= 15 and xPos <= 16 then
- fieldTarget = fieldTarget + 1.001/fieldTargetSetDivider2
- elseif yPos == 9 and xPos == 18 then
- fieldTarget = fieldTarget + 0.101/fieldTargetSetDivider2
- end
- if fieldTarget <= 10 and fieldTargetSetDivider == 1 then
- fieldTarget = 10
- end
- if yPos == 14 and xPos == 2 then
- saturationTarget = saturationTarget - 100000
- prevLowestSatSubtractor = 20000
- controlSelected = 2
- elseif yPos == 14 and xPos >= 4 and xPos <= 5 then
- saturationTarget = saturationTarget - 1000000.0
- prevLowestSatSubtractor = 20000
- controlSelected = 2
- elseif yPos == 14 and xPos >= 7 and xPos <= 9 then
- saturationTarget = saturationTarget - 10000000.0
- prevLowestSatSubtractor = 20000
- controlSelected = 2
- elseif yPos == 14 and xPos >= 11 and xPos <= 13 then
- saturationTarget = saturationTarget + 10000000.0
- prevLowestSatSubtractor = 2000000
- controlSelected = 2
- elseif yPos == 14 and xPos >= 15 and xPos <= 16 then
- saturationTarget = saturationTarget + 1000000.0
- prevLowestSatSubtractor = 200000
- controlSelected = 2
- elseif yPos == 14 and xPos == 18 then
- saturationTarget = saturationTarget + 100000
- prevLowestSatSubtractor = 20000
- controlSelected = 2
- end
- if controlSelected == 2 then
- if saturationTarget > 1000000000 then
- saturationTarget = 1000000000
- end
- if saturationTarget < 0 then
- saturationTarget = 0
- end
- end
- if fuelUseRateTarget >= 10000 then
- fuelUseRateTargetMultiplier = 10
- else
- fuelUseRateTargetMultiplier = 1
- end
- --if yPos == 4 and xPos == monX-17 then
- -- fuelUseRateTarget = fuelUseRateTarget - 1*fuelUseRateTargetMultiplier
- -- controlSelected = 3
- -- prevLowestSatSubtractor = 20000
- --elseif yPos == 4 and xPos >= monX-15 and xPos <= monX-14 then
- -- fuelUseRateTarget = fuelUseRateTarget - 10.0*fuelUseRateTargetMultiplier
- -- controlSelected = 3
- -- prevLowestSatSubtractor = 200000
- --elseif yPos == 4 and xPos >= monX-12 and xPos <= monX-10 then
- -- fuelUseRateTarget = fuelUseRateTarget - 100.0*fuelUseRateTargetMultiplier
- -- controlSelected = 3
- -- prevLowestSatSubtractor = 2000000
- --elseif yPos == 4 and xPos >= monX-8 and xPos <= monX-6 then
- -- fuelUseRateTarget = fuelUseRateTarget + 100.0*fuelUseRateTargetMultiplier
- -- controlSelected = 3
- -- prevLowestSatSubtractor = 20000
- --elseif yPos == 4 and xPos >= monX-4 and xPos <= monX-3 then
- -- fuelUseRateTarget = fuelUseRateTarget + 10.0*fuelUseRateTargetMultiplier
- -- controlSelected = 3
- -- prevLowestSatSubtractor = 20000
- --elseif yPos == 4 and xPos == monX-1 then
- -- fuelUseRateTarget = fuelUseRateTarget + 1*fuelUseRateTargetMultiplier
- -- controlSelected = 3
- -- prevLowestSatSubtractor = 20000
- --end
- if controlSelected == 3 then
- if fuelUseRateTarget < 500 then
- fuelUseRateTarget = 500.5
- end
- end
- if yPos == 9 and xPos == monX-17 then
- conversionTarget = conversionTarget - 0.1
- elseif yPos == 9 and xPos >= monX-15 and xPos <= monX-14 then
- conversionTarget = conversionTarget - 1.0
- elseif yPos == 9 and xPos >= monX-12 and xPos <= monX-10 then
- conversionTarget = conversionTarget - 10.0
- elseif yPos == 9 and xPos >= monX-8 and xPos <= monX-6 then
- conversionTarget = conversionTarget + 10.0
- elseif yPos == 9 and xPos >= monX-4 and xPos <= monX-3 then
- conversionTarget = conversionTarget + 1.0
- elseif yPos == 9 and xPos == monX-1 then
- conversionTarget = conversionTarget + 0.1
- end
- if conversionTarget > 100 then
- conversionTarget = 100
- end
- if conversionTarget < 0 then
- conversionTarget = 0
- end
- if yPos == 14 and xPos == monX-17 then
- targetPowerOutput = targetPowerOutput - 1000.0
- controlSelected = 5
- elseif yPos == 14 and xPos >= monX-15 and xPos <= monX-14 then
- targetPowerOutput = targetPowerOutput - 10000.0
- controlSelected = 5
- elseif yPos == 14 and xPos >= monX-12 and xPos <= monX-10 then
- targetPowerOutput = targetPowerOutput - 100000.0
- controlSelected = 5
- elseif yPos == 14 and xPos >= monX-8 and xPos <= monX-6 then
- targetPowerOutput = targetPowerOutput + 100000.0
- controlSelected = 5
- elseif yPos == 14 and xPos >= monX-4 and xPos <= monX-3 then
- targetPowerOutput = targetPowerOutput + 10000.0
- controlSelected = 5
- elseif yPos == 14 and xPos == monX-1 then
- targetPowerOutput = targetPowerOutput + 1000.0
- controlSelected = 5
- end
- if targetPowerOutput < 0*reactorOutputMultiplier then
- targetPowerOutput = 0*reactorOutputMultiplier
- end
- if fieldTarget <= 10 then
- fieldTarget = math.floor(fieldTarget*10.0*10.0)/100.0
- else
- fieldTarget = math.floor(fieldTarget*10.0)/10.0
- end
- if fieldTarget < 0.00001 then
- fieldTarget = 0.00001
- elseif fieldTarget > 100 then
- fieldTarget = 100
- end
- if safetySystems == 1 then
- if tempTarget > 10000 then
- tempTarget = 10000
- end
- if targetPowerOutput > 25000000*reactorOutputMultiplier then
- targetPowerOutput = 25000000*reactorOutputMultiplier
- end
- if conversionTarget > 90 then
- conversionTarget = 90
- end
- if fuelUseRateTarget > 51000.5 then
- fuelUseRateTarget = 51000.5
- end
- if saturationTarget < 85000000 then
- saturationTarget = 85000000
- end
- if fieldTarget <= 5 and safetySystems == 1 then
- fieldTarget = 5
- end
- end
- if yPos == 17 and xPos >= 2 and xPos <= 5 then
- if info.status == "cold" or info.status == "cooling" or info.status == "stopping" then
- reactor.chargeReactor()
- reactor.activateReactor()
- else
- reactor.stopReactor()
- end
- end
- if yPos == 17 and xPos >= 15 and xPos <= 21 then
- ioLocked = toggle(ioLocked)
- end
- if yPos == 17 and xPos >= 23 and xPos <= 31 then
- ioSmoothing = toggle(ioSmoothing)
- end
- if yPos == 17 and xPos >= 8 and xPos <= 13 then
- configScreenSelected = true
- end
- end
- end
- end
- end
- --The main function that runs calculations and stuff every tick after the program has been initialized
- function main()
- if reactor ~= reactor then
- print ("a minor reactor disconnection error has been prevented! DE please fix your reactor disconnecting from cc randomly!")
- else
- info = reactor.getReactorInfo()
- end
- energyCoreExists = false
- energyCoreFull = false
- if energy_core ~= null then
- energyStored = energy_core.getEnergyStored()
- if energyStored ~= nil then
- energyCoreExists = true
- energyTransfer = energyStored - prevEnergyStored
- prevEnergyStored = energyStored
- end
- end
- if energyCoreExists and energyStored > energy_core.getMaxEnergyStored()-100000 and ioSmoothing == 1 then
- energyCoreFull = true
- end
- if info == nil then
- print ("a MAJOR reactor disconnection error has been prevented! DE please fix your reactor disconnecting from cc randomly!")
- info = prevInfo
- end
- prevInfo = info
- coreSat = info.energySaturation / info.maxEnergySaturation
- fuelConversion = info.fuelConversion / info.maxFuelConversion * 100
- avaliableFuelDivider = 10368 / info.maxFuelConversion
- maxSmoothing = maxIOsmoothing / avaliableFuelDivider
- tempDrainFactor = 0
- if info.temperature > 8000 then
- tempDrainFactor = 1 + ((info.temperature-8000)^2 * 0.0000025)
- elseif info.temperature > 2000 then
- tempDrainFactor = 1
- elseif info.temperature > 1000 then
- tempDrainFactor = (info.temperature-1000)/1000
- end
- fieldPercentage = (info.fieldStrength/info.maxFieldStrength)*100
- saturationPercentage = (info.energySaturation/info.maxEnergySaturation)*100
- fieldStrengthError = (info.maxFieldStrength * fieldTarget/100) - info.fieldStrength
- requiredInput = math.min((info.maxFieldStrength * info.fieldDrainRate) / (info.maxFieldStrength - info.fieldStrength), info.maxFieldStrength - info.fieldStrength)
- if requiredInput ~= requiredInput then
- requiredInput = 0
- end
- powerInput = ((math.min(fieldStrengthError + requiredInput, info.maxFieldStrength))+1)*reactorOutputMultiplier
- fuelUseRate = (tempDrainFactor*(1D-coreSat)*(0.005)*1000000)*reactorFuelUsageMultiplier
- if controlSelected == 0 then
- temperatureControlSelected()
- elseif controlSelected == 2 then
- saturationControlSelected()
- elseif controlSelected == 3 then
- conversionRateControlSelected()
- elseif controlSelected == 5 then
- powerOutputControlSelected()
- end
- if info.status == "running" and fuelConversion >= conversionTarget then
- reactor.stopReactor()
- print("Fuel conversion levels above set target. Stopping reactor!")
- end
- if info.status == "warming_up" then
- if fieldPercentage >= 10 or fastStartup == 1 then
- if saturationPercentage >= 50 and fastStartup == 0 then
- powerInput = 500000*reactorOutputMultiplier/avaliableFuelDivider
- else
- powerInput = 100000000*reactorOutputMultiplier/avaliableFuelDivider
- end
- else
- powerInput = 10000*reactorOutputMultiplier/avaliableFuelDivider
- end
- if info.temperature >= 2000 then
- reactor.activateReactor()
- end
- end
- if powerOutput ~= powerOutput then
- powerOutput = 0
- end
- if powerInput ~= powerInput then
- powerInput = 0
- end
- if ioLocked ~= 1 and energyCoreFull == false then
- if ioSmoothing ~= 1 then
- powerInputUpdated = powerInput
- powerOutputUpdated = powerOutput
- else
- inputSmoothingError = powerInput - powerInputUpdated
- outputSmoothingError = powerOutput - powerOutputUpdated
- if inputSmoothingError > maxSmoothing then
- inputSmoothingError = maxSmoothing
- elseif inputSmoothingError < -maxSmoothing then
- inputSmoothingError = -maxSmoothing
- end
- if outputSmoothingError > maxSmoothing then
- outputSmoothingError = maxSmoothing
- elseif outputSmoothingError < -maxSmoothing then
- outputSmoothingError = -maxSmoothing
- end
- powerInputUpdated = powerInputUpdated + inputSmoothingError
- powerOutputUpdated = powerOutputUpdated + outputSmoothingError
- end
- if powerOutputUpdated <= 0 then
- powerOutputUpdated = 0
- end
- if powerInputUpdated <= 0 then
- powerInputUpdated = 0
- end
- if info.status == "cold" then
- powerInputUpdated = 0
- powerOutputUpdated = 0
- end
- if IOlimiting == 1 then
- convLVL = ((info.fuelConversion / info.maxFuelConversion * 1.3)*5.2)^0.83 + 1
- if powerInputUpdated < IOlimitingMinIN/avaliableFuelDivider then
- if info.status == "stopping" or info.status == "running" then
- powerInputUpdated = IOlimitingMinIN/avaliableFuelDivider
- end
- end
- if powerOutputUpdated > IOlimitingMaxOUT/avaliableFuelDivider*convLVL then
- powerOutputUpdated = IOlimitingMaxOUT/avaliableFuelDivider*convLVL
- end
- end
- inputGate.setFlowOverride(powerInputUpdated)
- outputGate.setFlowOverride(powerOutputUpdated)
- end
- end
- --Displays controls, reactor temperature and stuff
- function controlScreen()
- gClear()
- corePosX = monX/2
- corePosY = monY/2-2
- coreColor = colors.gray
- remainingFuel = (info.maxFuelConversion - info.fuelConversion) * 1000
- fuelTargetRemove = (info.maxFuelConversion * 1000 * ((100 - conversionTarget)/100))
- reactableFuel = remainingFuel - fuelTargetRemove
- fuelETA = (reactableFuel / fuelUseRate) * 1000 / 20
- if fuelETA < 0 then
- fuelETA = 0
- end
- gDrawProgressBar(2, 19, mon.x, 10, bottomBarColor, bottomBarColor)
- gWrite("FPS: " .. math.floor(scriptFPS*10)/10, 2, 19, fpsColor, bottomBarColor)
- if energyCoreExists then
- gWrite("E.S: " .. energyStored, 12, 19, colors.white, bottomBarColor)
- if energyTransfer < 0 and powerOutputUpdated < powerInputUpdated then
- explosionETA = math.max(0,(energyStored / -energyTransfer)/20)
- gWrite("Explosion In: " .. secondsToTimeStringExtended(explosionETA), corePosX-13, 18, colors.yellow, colors.red)
- end
- end
- if scriptStatusDisplay ~= 0 then
- gWrite(" ", 1, 19, colors.white, colors.green)
- scriptStatusDisplay = 0
- else
- gWrite(" ", 1, 19, colors.white, colors.red)
- scriptStatusDisplay = 1
- end
- gWrite("CONFIG", 8, 17, colors.white, colors.purple)
- if ioLocked ~= 1 then
- gWrite("LOCK IO", 15, 17, colors.lightGray, colors.yellow)
- else
- gWrite("LOCK IO", 15, 17, colors.lightGray, colors.orange)
- end
- if ioSmoothing ~= 1 then
- gWrite("IO SMOOTH", 23, 17, colors.gray, colors.lime)
- else
- gWrite("IO SMOOTH", 23, 17, colors.gray, colors.green)
- end
- if info.status == "stopping" or info.status == "cold" or info.status == "cooling" then
- if info.maxFuelConversion ~= 0 then
- gWrite("START", 2, 17, colors.white, colors.green)
- end
- elseif info.status ~= "beyond_hope" then
- gWrite("STOP", 2, 17, colors.white, colors.red)
- else
- gWrite("RUN", 2, 17, colors.yellow, colors.red)
- end
- if info.status == "running" or info.status == "stopping" then
- if info.temperature > 10000 then
- coreColor = colors.white
- elseif info.temperature > 9000 then
- coreColor = colors.yellow
- elseif info.temperature > 5700 then
- coreColor = colors.orange
- else
- coreColor = colors.red
- end
- elseif info.status == "cold" then
- coreColor = colors.gray
- elseif info.status == "warming_up" then
- coreColor = colors.lightGray
- end
- shieldColorTMP = colors.gray
- shieldColorTMP2 = colors.gray
- if fieldPercentage> 50 then
- shieldColorTMP2 = colors.lightBlue
- elseif fieldPercentage > 25 then
- shieldColorTMP2 = colors.cyan
- else
- shieldColorTMP2 = colors.blue
- end
- if info.status == "beyond_hope" then
- shieldColorTMP = colors.magenta
- shieldColorTMP2 = colors.magenta
- coreColor = colors.pink
- if math.random(0,100) > 90 then
- coreColor = colors.white
- end
- end
- if fieldPercentage > 9.13 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-3, corePosY-5, 9, 1, shieldColor, colors.gray)
- if fieldPercentage > 8.3 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-5, corePosY-4, 13, 1, shieldColor, colors.gray)
- if fieldPercentage > 7.47 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-6, corePosY-3, 15, 1, shieldColor, colors.gray)
- if fieldPercentage > 6.64 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-7, corePosY-2, 17, 1, shieldColor, colors.gray)
- if fieldPercentage > 5.81 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-8, corePosY-1, 19, 1, shieldColor, colors.gray)
- if fieldPercentage > 4.98 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-8, corePosY, 19, 1, shieldColor, colors.gray)
- if fieldPercentage > 4.15 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-8, corePosY+1, 19, 1, shieldColor, colors.gray)
- if fieldPercentage > 3.32 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-8, corePosY+2, 19, 1, shieldColor, colors.gray)
- if fieldPercentage > 2.49 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-7, corePosY+3, 17, 1, shieldColor, colors.gray)
- if fieldPercentage > 1.66 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-6, corePosY+4, 15, 1, shieldColor, colors.gray)
- if fieldPercentage > 0.83 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-5, corePosY+5, 13, 1, shieldColor, colors.gray)
- if fieldPercentage > 0.01 then
- shieldColor = shieldColorTMP2
- else
- shieldColor = shieldColorTMP
- end
- gDrawProgressBar(corePosX-3, corePosY+6, 9, 1, shieldColor, colors.gray)
- gDrawProgressBar(corePosX-3, corePosY-4, 9, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-5, corePosY-3, 13, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-6, corePosY-2, 15, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-7, corePosY-1, 17, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-7, corePosY, 17, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-7, corePosY+1, 17, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-7, corePosY+2, 17, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-6, corePosY+3, 15, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-5, corePosY+4, 13, 1, coreColor, colors.gray)
- gDrawProgressBar(corePosX-3, corePosY+5, 9, 1, coreColor, colors.gray)
- warnings = {}
- messageCooldown = messageCooldown + 1
- local tableValue = 0
- if energyCoreFull then
- table.insert(warnings, tableValue, energyCoreFullWarning)
- tableValue = tableValue + 1
- end
- if fuelConversion >= conversionTarget then
- table.insert(warnings, tableValue, fuelConversionWarning)
- tableValue = tableValue + 1
- end
- if powerOutputUpdated < powerInputUpdated then
- table.insert(warnings, tableValue, powerOutputWarning)
- tableValue = tableValue + 1
- end
- if info.status == "beyond_hope" then
- table.insert(warnings, tableValue, reactorBoomWarning)
- tableValue = tableValue + 1
- end
- if messageCooldown > 20 then
- currentTableValue = currentTableValue + 1
- messageCooldown = 0
- end
- if currentTableValue > tableValue then
- currentTableValue = 1
- end
- if warnings[currentTableValue] then
- warnings[currentTableValue]()
- end
- if info.maxFuelConversion == 0 then
- gWrite("Reactor Core Empty!", corePosX-8, 1, colors.orange, colors.black)
- elseif info.status == "cold" then
- gWrite("Reactor Offline", corePosX-6, 1, colors.lightGray, colors.black)
- elseif info.status == "warming_up" then
- gWrite("Charging Reactor...", corePosX-8, 1, colors.blue, colors.black)
- elseif info.status == "running" then
- gWrite("Reactor Online", corePosX-6, 1, colors.lime, colors.black)
- elseif info.status == "stopping" then
- gWrite("Shutting Down...", corePosX-6, 1, colors.yellow, colors.black)
- elseif info.status == "cooling" then
- gWrite("Cooling Down...", corePosX-6, 1, colors.cyan, colors.black)
- elseif info.status == "beyond_hope" then
- explosionTextState = explosionTextState + 1
- if explosionTextState > 5 then
- if explosionTextState > 10 then
- explosionTextState = 0
- end
- gWrite(" !!!EXPLOSION IMMINENT!!! ", corePosX-29, 1, colors.orange, colors.red)
- else
- gWrite(" !!!EXPLOSION IMMINENT!!! ", corePosX-29, 1, colors.red, colors.orange)
- end
- end
- if controlSelected == 0 then
- coreTempSelectorColor = colors.cyan
- else
- coreTempSelectorColor = colors.blue
- end
- gWrite("Core Temp: " .. info.temperature .. "°C", 2, 2, colors.white, colors.black)
- gWrite("Target: " .. math.floor(tempTarget*1000.0)/1000.0 .. "°C", 2, 3, colors.white, colors.black)
- gWrite("<", 2, 4, colors.white, coreTempSelectorColor)
- gWrite("<<", 4, 4, colors.white, coreTempSelectorColor)
- gWrite("<<<", 7, 4, colors.white, coreTempSelectorColor)
- gWrite(">>>", 11, 4, colors.white, coreTempSelectorColor)
- gWrite(">>", 15, 4, colors.white, coreTempSelectorColor)
- gWrite(">", 18, 4, colors.white, coreTempSelectorColor)
- if math.floor(info.temperature*10.0)/10.0 > math.floor(tempTarget*10.0)/10.0 then
- tempLineColor = colors.red
- elseif math.floor(info.temperature*10.0)/10.0 < math.floor(tempTarget*10.0)/10.0 then
- tempLineColor = colors.yellow
- else
- tempLineColor = colors.green
- end
- gDrawProgressBar(1, 5, 19, info.temperature/16000.0, tempLineColor, colors.gray)
- gWrite("Field: " .. fieldPercentage .. "%", 2, 7, colors.white, colors.black)
- gWrite("Target: " .. fieldTarget .. "%", 2, 8, colors.white, colors.black)
- gWrite("<", 2, 9, colors.white, colors.blue)
- gWrite("<<", 4, 9, colors.white, colors.blue)
- gWrite("<<<", 7, 9, colors.white, colors.blue)
- gWrite(">>>", 11, 9, colors.white, colors.blue)
- gWrite(">>", 15, 9, colors.white, colors.blue)
- gWrite(">", 18, 9, colors.white, colors.blue)
- if math.floor(info.fieldStrength/info.maxFieldStrength*1000.0)/10.0 > fieldTarget then
- fieldLineColor = colors.yellow
- elseif math.floor((info.fieldStrength+1000)/info.maxFieldStrength*1000.0)/10.0 < fieldTarget then
- fieldLineColor = colors.red
- else
- fieldLineColor = colors.green
- end
- if fieldStrength == 0 then
- fieldAdder = 0.1
- else
- fieldAdder = 0
- end
- gDrawProgressBar(1, 10, 19, (math.floor((info.fieldStrength+1000)/info.maxFieldStrength*10*10)/100) + fieldAdder, fieldLineColor, colors.gray)
- if controlSelected == 2 then
- saturationSelectorColor = colors.cyan
- else
- saturationSelectorColor = colors.blue
- end
- gWrite("Saturation: " .. math.floor(saturationPercentage*100.0)/100.0 .. "%", 2, 12, colors.white, colors.black)
- gWrite("Target: " .. math.min(100,math.floor(saturationTarget/info.maxEnergySaturation*10000)/100) .. "%", 2, 13, colors.white, colors.black)
- gWrite("<", 2, 14, colors.white, saturationSelectorColor)
- gWrite("<<", 4, 14, colors.white, saturationSelectorColor)
- gWrite("<<<", 7, 14, colors.white, saturationSelectorColor)
- gWrite(">>>", 11, 14, colors.white, saturationSelectorColor)
- gWrite(">>", 15, 14, colors.white, saturationSelectorColor)
- gWrite(">", 18, 14, colors.white, saturationSelectorColor)
- if math.floor(info.energySaturation/10000000*100.0)/100.0 < math.floor(saturationTarget/10000000*10.0*10)/100.0 then
- saturationLineColor = colors.red
- elseif math.floor(info.energySaturation/10000000*100.0)/100.0 > math.floor(saturationTarget/10000000*10.0*10)/100.0 then
- saturationLineColor = colors.yellow
- else
- saturationLineColor = colors.green
- end
- gDrawProgressBar(1, 15, 19, math.floor(info.energySaturation/info.maxEnergySaturation*1100.0*10)/10000.0, saturationLineColor, colors.gray)
- --if controlSelected == 3 then
- -- convrateSelectorColor = colors.cyan
- --else
- -- convrateSelectorColor = colors.blue
- --end
- convrateSelectorColor = colors.lightGray
- gWriteR(math.floor(fuelUseRate*1)/1.0 .. "nb/t" .. " :Conv Rate", 0, 2, colors.white, colors.black)
- gWriteR(math.floor(fuelUseRateTarget*1)/1.0 .. "nb/t " .. " :Target", 0, 3, colors.white, colors.black)
- gWrite("<", monX-17, 4, colors.white, convrateSelectorColor)
- gWrite("<<",monX-15, 4, colors.white, convrateSelectorColor)
- gWrite("<<<", monX-12, 4, colors.white, convrateSelectorColor)
- gWrite(">>>", monX-8, 4, colors.white, convrateSelectorColor)
- gWrite(">>", monX-4, 4, colors.white, convrateSelectorColor)
- gWrite(">", monX-1, 4, colors.white, convrateSelectorColor)
- if math.floor(fuelUseRate*1)/1.0 < math.floor(fuelUseRateTarget*1)/1.0 then
- fuelUseRateLineColor = colors.yellow
- elseif math.floor(fuelUseRate*1)/1.0 > math.floor(fuelUseRateTarget*1)/1.0 then
- fuelUseRateLineColor = colors.red
- else
- fuelUseRateLineColor = colors.green
- end
- gDrawProgressBar(monX-18, 5, 19, fuelUseRate/20000, fuelUseRateLineColor, colors.gray)
- gWriteR(math.floor(fuelConversion*10)/10.0 .. "%" .. " :Conv Level", 0, 7, colors.white, colors.black)
- gWriteR(conversionTarget .. "%" .. " :Stop at", 0, 8, colors.white, colors.black)
- gWrite("<", monX-17, 9, colors.white, colors.blue)
- gWrite("<<", monX-15, 9, colors.white, colors.blue)
- gWrite("<<<", monX-12, 9, colors.white, colors.blue)
- gWrite(">>>", monX-8, 9, colors.white, colors.blue)
- gWrite(">>", monX-4, 9, colors.white, colors.blue)
- gWrite(">", monX-1, 9, colors.white, colors.blue)
- if fuelConversion > conversionTarget then
- convLevelLineColor = colors.red
- elseif fuelConversion > conversionTarget/1.1 then
- convLevelLineColor = colors.orange
- elseif fuelConversion > conversionTarget/1.25 then
- convLevelLineColor = colors.yellow
- else
- convLevelLineColor = colors.green
- end
- local fuelBarFillage = fuelConversion/info.maxFuelConversion*19 / (conversionTarget/70)
- gDrawProgressBar(monX-18, 10, 19, fuelBarFillage, convLevelLineColor, colors.gray)
- if fuelUseRate > 1 then
- gWriteTextOnly(secondsToTimeString(fuelETA), monX-18, 10, colors.white, fuelBarFillage*19)
- else
- gWriteTextOnly(("-:-d -:-h -:-m -:-s"), monX-18, 10, colors.white, fuelBarFillage*19)
- end
- if controlSelected == 5 then
- outputSelectorColor = colors.cyan
- else
- outputSelectorColor = colors.blue
- end
- gWriteR(math.floor(info.generationRate-powerInput*1)/1.0 .. "OP/t" .. " :Total", 0, 12, colors.white, colors.black)
- gWriteR(math.floor(targetPowerOutput*1)/1.0 .. "OP/t" .. " :Target", 0, 13, colors.white, colors.black)
- gWrite("<", monX-17, 14, colors.white, outputSelectorColor)
- gWrite("<<", monX-15, 14, colors.white, outputSelectorColor)
- gWrite("<<<", monX-12, 14, colors.white, outputSelectorColor)
- gWrite(">>>", monX-8, 14, colors.white, outputSelectorColor)
- gWrite(">>", monX-4, 14, colors.white, outputSelectorColor)
- gWrite(">", monX-1, 14, colors.white, outputSelectorColor)
- if (powerOutput-powerInput)+1000*reactorOutputMultiplier < math.floor(targetPowerOutput*1)/1.0 then
- outputLineColor = colors.red
- elseif (powerOutput-powerInput)-1000*reactorOutputMultiplier > math.floor(targetPowerOutput*1)/1.0 then
- outputLineColor = colors.yellow
- else
- outputLineColor = colors.green
- end
- gDrawProgressBar(monX-18, 15, 19, (info.generationRate-powerInput*1)/25000000/reactorOutputMultiplier, outputLineColor, colors.gray)
- ioColor = colors.white
- if IOlimiting == 1 and ioLocked ~= 1 and ioSmoothing ~= 1 then
- ioColor = colors.cyan
- gWrite("I/O LIMITED!", corePosX-5, corePosY+9, colors.cyan, colors.black)
- end
- if ioSmoothing == 1 and ioLocked ~= 1 then
- ioColor = colors.lime
- gWrite("I/O SMOOTHED!", corePosX-5, corePosY+9, colors.green, colors.black)
- end
- if ioLocked == 1 then
- ioColor = colors.orange
- gWrite("I/O LOCKED!", corePosX-4, corePosY+9, colors.yellow, colors.black)
- end
- if energyCoreFull then
- gWrite("I/O FORCELOCKED!", corePosX-7, corePosY+9, colors.red, colors.black)
- end
- gWrite("IN: " .. math.floor(powerInputUpdated*1.0)/1.0 .. "OP/t", corePosX-6, corePosY+7, ioColor, colors.black)
- gWrite("OUT: " .. math.floor(powerOutputUpdated*1.0)/1.0 .. "OP/t", corePosX-7, corePosY+8, ioColor, colors.black)
- end
- --Runs when the config screen is selected or when the program isnt initialized
- function configScreen()
- gClear()
- gDrawProgressBar(2, 19, mon.x, 10, bottomBarColor, bottomBarColor)
- gWrite("FPS: " .. math.floor(scriptFPS*10)/10, 2, 19, fpsColor, bottomBarColor)
- if energyCoreExists then
- gWrite("E.S: " .. energyStored, 12, 19, colors.white, bottomBarColor)
- end
- if scriptStatusDisplay ~= 0 then
- gWrite(" ", 1, 19, colors.white, colors.green)
- scriptStatusDisplay = 0
- else
- gWrite(" ", 1, 19, colors.white, colors.red)
- scriptStatusDisplay = 1
- end
- gWrite("1.12.2 Mode:", 2, 2, colors.white, colors.black)
- gWrite("Fast Startup:", 2, 3, colors.white, colors.black)
- gWrite("Safety Systems:", 2, 4, colors.white, colors.black)
- gWrite("Sat. Safety Override:", 2, 5, colors.white, colors.black)
- gWrite("I/O limiting:", 2, 6, colors.white, colors.black)
- if onePointTwelveMode == 1 then
- gWrite("ON", 15, 2, colors.white, colors.green)
- else
- gWrite("OF", 15, 2, colors.white, colors.red)
- end
- if fastStartup == 1 then
- gWrite("ON", 16, 3, colors.white, colors.green)
- else
- gWrite("OF", 16, 3, colors.white, colors.red)
- end
- if safetySystems == 1 then
- gWrite("ON", 18, 4, colors.white, colors.green)
- else
- gWrite("OF", 18, 4, colors.white, colors.red)
- end
- if saturationSafetyOverride == 1 then
- gWrite("ON", 24, 5, colors.white, colors.green)
- else
- gWrite("OF", 24, 5, colors.white, colors.red)
- end
- if IOlimiting == 1 then
- gWrite("ON", 16, 6, colors.white, colors.green)
- else
- gWrite("OF", 16, 6, colors.white, colors.red)
- end
- gWrite("CONFIG", 8, 17, colors.white, colors.purple)
- end
- -- run the update function and the monitor function in parallel so the entire program dosent only tick when someone clicks the monitor
- parallel.waitForAny(update, updateMon)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement