Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r = peripheral.find("BigReactors-Reactor")
- t = peripheral.wrap("BigReactors-Turbine_0")
- t1 = peripheral.wrap("BigReactors-Turbine_1")
- m = peripheral.wrap("right")
- local isActive = false
- local rotorSpeed = 1800
- local rotorSpeed1 = 1800
- local RFGen = 0
- local RFGen1 = 0
- local steam = 0
- local steam1 = 0
- function comma_value(amount)
- local formatted = amount
- local swap = false
- if formatted < 0 then
- formatted = formatted*-1
- swap = true
- end
- while true do
- formatted, k = string.gsub(formatted, "^(%d+)(%d%d%d)", '%1,%2')
- if k == 0 then
- break
- end
- end
- if swap then
- formatted = "-"..formatted
- end
- return formatted
- end
- r.setActive(false)
- t.setInductorEngaged(false)
- t.setActive(true)
- t1.setInductorEngaged(false)
- t1.setActive(true)
- while true do
- print("Sleep")
- sleep(5)
- if rotorSpeed < 1750 then
- print("Extra sleep because of slow rotor!")
- sleep(5)
- end
- if isActive then
- if not redstone.getInput("back") then
- print("Disable")
- isActive = false
- r.setActive(false)
- sleep(0.5)
- t.setInductorEngaged(false)
- t1.setInductorEngaged(false)
- end
- else
- if redstone.getInput("back") then
- print("Enable")
- isActive = true
- r.setActive(true)
- sleep(0.1)
- t.setInductorEngaged(true)
- t1.setInductorEngaged(true)
- end
- end
- m.clear()
- rotorSpeed = t.getRotorSpeed()
- rotorSpeed1 = t1.getRotorSpeed()
- if isActive then
- print("Active!")
- RFGen = t.getEnergyProducedLastTick()
- RFGen1 = t1.getEnergyProducedLastTick()
- steam = t.getFluidFlowRate()
- steam1 = t1.getFluidFlowRate()
- m.setCursorPos(1,1)
- if rotorSpeed > 1900 then
- m.setTextColor(colors.red)
- m.setCursorPos(1,10)
- m.write("RPM Too High!! Disabling the Reactor and Enabling the Coils!")
- print("RPM Too High!! Disabling the Reactor and Enabling the Coils!")
- t.setInductorEngaged(true)
- t1.setInductorEngaged(true)
- r.setActive(false)
- m.setCursorPos(1,1)
- elseif rotorSpeed < 1750 then
- m.setTextColor(colors.blue)
- m.setCursorPos(1,10)
- m.write("RPM Too Low!! Disabling the Coils and Enabling the Reactor!")
- print("RPM Too Low!! Disabling the Coils and Enabling the Reactor!")
- t.setInductorEngaged(false)
- t1.setInductorEngaged(false)
- r.setActive(true)
- m.setCursorPos(1,1)
- else
- m.setTextColor(colors.lime)
- t.setInductorEngaged(true)
- t1.setInductorEngaged(true)
- r.setActive(true)
- end
- m.write("1. Rotor speed:"..comma_value(rotorSpeed).."RPM")
- m.setCursorPos(1,2)
- m.write("2. Rotor speed:"..comma_value(rotorSpeed1).."RPM")
- m.setCursorPos(1,4)
- m.setTextColor(colors.lime)
- m.write("1. RF Generation:"..comma_value(RFGen).."RF/t")
- m.setCursorPos(1,5)
- m.write("2. RF Generation:"..comma_value(RFGen1).."RF/t")
- m.setCursorPos(1,7)
- if steam < 1990 then
- m.setTextColor(colors.red)
- else
- m.setTextColor(colors.lime)
- end
- m.write("1. Steam Generation:"..comma_value(steam).."mB/t")
- m.setCursorPos(1,8)
- m.write("2. Steam Generation:"..comma_value(steam1).."mB/t")
- else
- m.setCursorPos(1,1)
- if rotorSpeed > 1900 then
- m.setTextColor(colors.red)
- m.setCursorPos(1,6)
- m.write("RPM Too High!! Disabling the Reactor and Enabling the Coils!")
- print("RPM Too High!! Disabling the Reactor and Enabling the Coils!")
- t.setInductorEngaged(true)
- t1.setInductorEngaged(true)
- r.setActive(false)
- m.setCursorPos(1,1)
- elseif rotorSpeed < 1750 then
- m.setTextColor(colors.blue)
- m.setCursorPos(1,6)
- m.write("RPM Too Low!! Disabling the Coils and Enabling the Reactor!")
- print("RPM Too Low!! Disabling the Coils and Enabling the Reactor!")
- t.setInductorEngaged(false)
- t1.setInductorEngaged(false)
- r.setActive(true)
- m.setCursorPos(1,1)
- else
- m.setTextColor(colors.lime)
- t.setInductorEngaged(false)
- t1.setInductorEngaged(false)
- r.setActive(false)
- end
- m.write("1. Rotor speed:"..comma_value(rotorSpeed).."RPM")
- m.setCursorPos(1,2)
- m.write("2. Rotor speed:"..comma_value(rotorSpeed1).."RPM")
- m.setCursorPos(1,4)
- m.setTextColor(colors.red)
- m.write("Not Active!")
- m.setTextColor(colors.white)
- print("Not Active!")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement