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
- log ("Turbine max energy: " ..turbineMaxEnergy..)
- log ("Reactor max temp:" ..reactorMaxTemp..)
- updatePeripherals()
- listPeripherals()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement