Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Reactor and turbine control script by EternalClickbait
- --Reactor, turbine and monitor must be connected with wired modems to the computer
- local reactors = {}
- local turbines = {}
- local monitors = {}
- --The maximum temperature for the reactor
- local reactorMaxTemp = 200
- --The maximum energy in our turbine's buffer. Max is 1M (1,000,000)
- local turbineMaxEnergy = 500000
- function log(message)
- print(message)
- for _, side in ipairs(monitors) do
- peripheral.wrap(side).write(message)
- end
- end
- --Updates the list of reactors, turbines and monitor
- function updatePeripherals()
- local peripherals = peripheral.getNames() --Get a list of all the peripherals
- log("Peripherals:")
- for _, pSide in ipairs(peripherals) do
- local pType = peripheral.getType(pSide)
- local pFunctions = peripheral.wrap(pSide)
- if(pType == "BigReactors-Reactor") then --If we found a reactor
- table.insert(reactors, pSide)
- elseif (pType == "BigReactors-Turbine") then
- table.insert(turbines, pSide)
- elseif (pType == "monitor") then
- table.insert(monitors, pSide)
- end
- end
- end
- --Lists all of the peripherals connected
- function listPeripherals()
- log("Reactors:")
- for i, pSide in ipairs(reactors) do
- log("\t" ..i.. ":\t" ..pSide)
- end
- log("Turbines:")
- for i, pSide in ipairs(turbines) do
- log("\t" ..i.. ":\t" ..pSide)
- end
- log("Monitors:")
- for i, pSide in ipairs(monitors) do
- log("\t" ..i.. ":\t" ..pSide)
- end
- end
- function showReactorInfo()
- for _, pSide in ipairs(reactors) do
- local r = peripheral.wrap(pSide)
- log("Reactor '" ..pSide.. "': ")
- log("\tFuel level:\t" ..r.getFuelAmount())
- log("\tFuel waste:\t" ..r.getFuelAmount())
- log("\tFuel temp:\t" ..r.getFuelTemperature())
- log("\tCase temp:\t" ..r.getCasingTemperature())
- log("\tActive:\t\t" ..r.getActive())
- end
- end
- function showTurbineInfo()
- for _, pSide in ipairs(turbines) do
- log("Turbine '" ..pSide.. "': ")
- log("\t ")
- end
- end
- log ("Turbine max energy: " ..turbineMaxEnergy)
- log ("Reactor max temp:" ..reactorMaxTemp)
- updatePeripherals()
- listPeripherals()
- sleep(1000)
- showReactorInfo()
- showTurbineInfo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement