Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tur1 = peripheral.wrap("BigReactors-Turbine_3")
- tur2 = peripheral.wrap("BigReactors-Turbine_4")
- tur3 = peripheral.wrap("BigReactors-Turbine_5")
- tur4 = peripheral.wrap("BigReactors-Turbine_6")
- rednet.open("bottom")
- while true do
- term.clear()
- term.setCursorPos(1,1)
- TB1statt = tostring(tur1.getActive())
- if TB1statt == "true" then TB1stat = "active"
- else TB1stat = "offline"
- end
- TB2statt = tostring(tur2.getActive())
- if TB2statt == "true" then TB2stat = "active"
- else TB2stat = "offline"
- end
- TB3statt = tostring(tur3.getActive())
- if TB3statt == "true" then TB3stat = "active"
- else TB3stat = "offline"
- end
- TB4statt = tostring(tur4.getActive())
- if TB4statt == "true" then TB4stat = "active"
- else TB4stat = "offline"
- end
- print("turbine 1 status: "..TB1stat)
- print("turbine 2 status: "..TB4stat)
- print("turbine 3 status: "..TB2stat)
- print("turbine 4 status: "..TB3stat)
- print("")
- tb1EN = tur1.getEnergyStored()
- tb2EN = tur2.getEnergyStored()
- tb3EN = tur3.getEnergyStored()
- tb4EN = tur4.getEnergyStored()
- tb1pp = tb1EN / 1000000*100
- tb2pp = tb2EN / 1000000*100
- tb3pp = tb3EN / 1000000*100
- tb4pp = tb4EN / 1000000*100
- tb1p = math.floor(tb1pp * 100)/100
- tb2p = math.floor(tb2pp * 100)/100
- tb3p = math.floor(tb3pp * 100)/100
- tb4p = math.floor(tb4pp * 100)/100
- all = (tb1EN + tb2EN + tb3EN + tb4EN) /4
- allp = all /1000000 * 100
- allp = math.floor(allp *100)/100
- print("turbine 1 energy: "..tb1EN.." => "..tb1p.."%")
- print("turbine 2 energy: "..tb4EN.." => "..tb4p.."%")
- print("turbine 3 energy: "..tb2EN.." => "..tb2p.."%")
- print("turbine 4 energy: "..tb3EN.." => "..tb3p.."%")
- print("")
- print("All turbine buffer % status: "..allp.."%")
- print("")
- print("")
- print("")
- print("Additional information:")
- if (tb1p < 30) or (tb2p < 30) or (tb3p < 30) or (tb4p < 30) then
- redstone.setOutput("front",true)
- rednet.send(45,"RUN")
- print("Starting reactor and turbines due to one turbine is energy <30%")
- tur1.setActive(true)
- tur2.setActive(true)
- tur3.setActive(true)
- tur4.setActive(true)
- else
- print("No need to start reactor")
- end
- if (allp > 95) then
- redstone.setOutput("front",false)
- rednet.send(45,"STOP")
- tur1.setActive(false)
- tur2.setActive(false)
- tur3.setActive(false)
- tur4.setActive(false)
- print("Stopping reactor and turbines due to energy > 95%")
- else
- print("No need to stop reactor")
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement