Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local turbines = {peripheral.find("BigReactors-Turbine")}
- local numTurbine = #turbines
- local top = 1846
- local bot = 1838
- local goal = 1842
- local fix = {".", ".", ".", "."}
- rednet.open("front")
- print(numTurbine)
- function stuff(tur, eng, act)
- tur.setInductorEngaged(eng)
- tur.setActive(act)
- end
- while true do
- print("1")
- for i=1, numTurbine do
- local t = turbines[i]
- local speed = t.getRotorSpeed()
- local power = t.getEnergyProducedLastTick()
- local engaged = t.getInductorEngaged()
- local active = t.getActive()
- print("2")
- if(speed > top) then
- print("3a1")
- stuff(t,true,false)
- fix[i] = "H"
- print("3a2")
- elseif(speed < bot) then
- print("3b1")
- stuff(t,false,true)
- fix[i] = "L"
- print("3b2")
- end
- if(fix[i] == "H") and (speed < goal) then
- print("4a1")
- stuff(t,true,true)
- fix[i] = "."
- print("4a2")
- elseif(fix[i] == "L") and (speed > goal) then
- print("4b1")
- stuff(t,true,true)
- fix[i] = "."
- print("4b2")
- elseif(fix[i] == ".") then
- print("4c1")
- fix[i] = "_"
- print("4c2")
- elseif(fix[i] == "_") then
- print("4d1")
- fix[i] = "."
- print("4d2")
- end
- print("here1")
- rednet.send(62,
- {string.format("p:%d",power),
- string.format("r:%d",speed),
- "c:"..string.sub(tostring(engaged),1,1)..
- "a:"..string.sub(tostring(active),1,1)..
- "s:"..fix[i]}, i)
- print("here2")
- print("5")
- sleep(0.025)
- print("6")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment