Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReactorCount = 0
- local Reactor = {}
- local TurbineCount = 0
- local Turbine = {}
- local Capacitor = {}
- local CapConnections = 0
- function peripheralSearch()
- print("Initializing Connections...")
- sleep(.2)
- for a,b in pairs(peripheral.getNames()) do
- if peripheral.getType(b) == "BigReactors-Turbine" then
- print("Turbine Synced.")
- Turbine[#Turbine+1] = peripheral.wrap(b)
- TurbineCount = TurbineCount + 1
- sleep(.15)
- elseif peripheral.getType(b) == "tile_blockcapacitorbank_name" then
- print("Capacitor Bank Synced")
- Capacitor[#Capacitor+1] = peripheral.wrap(b)
- CapConnections = CapConnections + 1
- sleep(.15)
- elseif peripheral.getType(b) == "BigReactors-Reactor" then
- print("Reactor Synced.")
- Reactor[#Reactor+1] = peripheral.wrap(b)
- ReactorCount = ReactorCount + 1
- sleep(.15)
- else
- print("Incompatible Device.")
- sleep(.15)
- end
- end
- sleep(.5)
- print()
- print()
- print()
- end
- --Capacitor Bank Calculations--
- CapCount = 1154
- CapBasic = 1000000
- CapStandard = 5000000
- CapVibrant = 25000000
- CapType = (CapBasic)
- TotalCapacity = (CapCount) * (CapType)
- --Start-up Peripheral Detection--
- peripheralSearch()
- --Debug--
- Debug = true
- if Debug == true then
- shell.run("clear")
- print("Debug On")
- print("----------")
- print(" ")
- print("Reactors Connected: ", ReactorCount)
- print("Reactor Connected: ", Reactor[1].getConnected())
- print("Turbines Connected: ", TurbineCount)
- print("Turbine 1 Connected: ", Turbine[1].getConnected())
- print("Turbine 2 Connected: ", Turbine[2].getConnected())
- print("Cap. Banks Connected: ", CapConnections)
- print("Capacitor Count: ", CapCount)
- print("Capacitor Type: ", CapType)
- print("Total Capacity: ", TotalCapacity)
- print(" ")
- print("Press any key to Continue.")
- wait = read()
- end
- --Capacitor Bank Fill Levels--
- EmptyLevel = (TotalCapacity * 0.01)
- LowLevel = (TotalCapacity * 0.15)
- MedLevel = (TotalCapacity * 0.35)
- HighLevel = (TotalCapacity * 0.65)
- FullLevel = (TotalCapacity * 0.95)
- if Debug == true then
- print("Empty Level: ", EmptyLevel)
- print("Low Level: ", LowLevel)
- print("Medium Level: ", MedLevel)
- print("High Level: ", HighLevel)
- print("Full Level: ", FullLevel)
- sleep(5)
- print("Actual Level: ")
- end
- while true do
- CapEnergyStored = Capacitor[1].getEnergyStored()
- EnergyStored = (CapEnergyStored) * (CapCount)
- if Debug == true then
- print(EnergyStored)
- end
- if EnergyStored <= EmptyLevel or EnergyStored == 0 then
- Reactor[1].setAllControlRodLevels(11)
- Turbine[1].setFluidFlowRateMax(1270)
- Turbine[2].setFluidFlowRateMax(1270)
- elseif EnergyStored >= EmptyLevel and EnergyStored <= LowLevel then
- Reactor[1].setAllControlRodLevels(11)
- Turbine[1].setFluidFlowRateMax(1260)
- Turbine[2].setFluidFlowRateMax(1260)
- elseif EnergyStored >= LowLevel and EnergyStored <= MedLevel then
- Reactor[1].setAllControlRodLevels(37)
- Turbine[1].setFluidFlowRateMax(1260)
- Turbine[2].setFluidFlowRateMax(550)
- elseif EnergyStored >= MedLevel and EnergyStored < HighLevel then
- Reactor[1].setAllControlRodLevels(61)
- Turbine[1].setFluidFlowRateMax(1260)
- Turbine[2].setFluidFlowRateMax(0)
- elseif EnergyStored >= HighLevel and EnergyStored <= FullLevel then
- Reactor[1].setAllControlRodLevels(82)
- Turbine[1].setFluidFlowRateMax(550)
- Turbine[2].setFluidFlowRateMax(0)
- elseif EnergyStored >= FullLevel then
- Reactor[1].setAllControlRodLevels(100)
- end
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment