Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("left")
- r1 = peripheral.wrap("BigReactors-Reactor_2")
- r2 = peripheral.wrap("BigReactors-Reactor_3")
- r3 = peripheral.wrap("BigReactors-Reactor_4")
- mod = 1
- x = 0
- y = 0
- r1mod = 0
- r1min = 2000000
- r1max = 7000000
- r1minarl = 50
- r1maxarl = 90
- r1ossz = 50
- r2mod = 0
- r2min = 2000000
- r2max = 7000000
- r2minarl = 50
- r2maxarl = 90
- r2ossz = 50
- automata1 = 0
- automata2 = 0
- function click()
- event, pos, x, y = os.pullEvent("monitor_touch")
- end
- function drawLine(x,y,l,s,c)
- for yPos = y, y+l-1 do
- mon.setBackgroundColor(c)
- mon.setCursorPos(x, yPos)
- mon.write(string.rep(" ", s))
- end
- mon.setBackgroundColor(colors.black)
- end
- function futas()
- mon.setTextScale(0.8)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- if x > 2 and x < 18 and y > 2 and y < 6 then
- mod = 1
- elseif x > 2 and x < 18 and y > 6 and y < 10 then
- mod = 2
- elseif x > 2 and x < 18 and y > 10 and y < 14 then
- mod = 3
- end
- if mod == 1 then
- if x > 59 and x < 71 and y > 2 and y < 6 then
- r1.setActive(true)
- x=0
- y=0
- elseif x > 71 and x < 83 and y > 2 and y < 6 then
- r1.setActive(false)
- x=0
- y=0
- elseif x > 71 and x < 83 and y > 6 and y < 10 then
- if automata1 == 0 then
- automata1 = 1
- else
- automata1 = 0
- end
- x=0
- y=0
- end
- if automata1 == 0 then
- if r1min < r1max and x > 24 and x < 43 and y > 13 and y < 15 then
- r1min = r1min + 1000000
- x=0
- y=0
- elseif r1min > 0 and x > 24 and x < 43 and y > 15 and y < 17 then
- r1min = r1min - 1000000
- x=0
- y=0
- elseif r1max < 10000000 and x > 59 and x < 78 and y > 13 and y < 15 then
- r1max = r1max + 1000000
- x=0
- y=0
- elseif r1max > r1min and x > 59 and x < 78 and y > 15 and y < 17 then
- r1max = r1max - 1000000
- x=0
- y=0
- elseif r1minarl < r1maxarl and x > 24 and x < 43 and y > 18 and y < 20 then
- r1minarl = r1minarl + 10
- x=0
- y=0
- elseif r1minarl > 0 and x > 24 and x < 43 and y > 19 and y < 21 then
- r1minarl = r1minarl - 10
- x=0
- y=0
- elseif r1maxarl < 100 and x > 59 and x < 78 and y > 18 and y < 20 then
- r1maxarl = r1maxarl + 10
- x=0
- y=0
- elseif r1maxarl > r1minarl and x > 59 and x < 78 and y > 19 and y < 21 then
- r1maxarl = r1maxarl - 10
- x=0
- y=0
- end
- else
- if x > 59 and x < 71 and y > 6 and y < 10 then
- if r1mod == 0 then
- r1mod = 1
- x = 0
- y = 0
- else
- r1mod = 0
- x = 0
- y = 0
- end
- end
- if r1mod == 0 then
- if r1ossz > 0 and x > 59 and x < 63 and y > 10 and y < 14 then
- r1ossz = r1ossz - 10
- x = 0
- y = 0
- elseif r1ossz < 100 and x > 66 and x < 71 and y > 10 and y < 14 then
- r1ossz = r1ossz + 10
- x = 0
- y = 0
- end
- else
- end
- end
- elseif mod == 2 then
- if x > 59 and x < 71 and y > 2 and y < 6 then
- r2.setActive(true)
- x=0
- y=0
- elseif x > 71 and x < 83 and y > 2 and y < 6 then
- r2.setActive(false)
- x=0
- y=0
- elseif x > 71 and x < 83 and y > 6 and y < 10 then
- if automata2 == 0 then
- automata2 = 1
- else
- automata2 = 0
- end
- x=0
- y=0
- end
- if automata2 == 0 then
- if r2min < r2max and x > 24 and x < 43 and y > 13 and y < 15 then
- r2min = r2min + 1000000
- x=0
- y=0
- elseif r2min > 0 and x > 24 and x < 43 and y > 15 and y < 17 then
- r1min = r1min - 1000000
- x=0
- y=0
- elseif r2max < 10000000 and x > 59 and x < 78 and y > 13 and y < 15 then
- r2max = r2max + 1000000
- x=0
- y=0
- elseif r2max > r2min and x > 59 and x < 78 and y > 15 and y < 17 then
- r2max = r2max - 1000000
- x=0
- y=0
- elseif r2minarl < r2maxarl and x > 24 and x < 43 and y > 18 and y < 20 then
- r2minarl = r2minarl + 10
- x=0
- y=0
- elseif r2minarl > 0 and x > 24 and x < 43 and y > 19 and y < 21 then
- r2minarl = r2minarl - 10
- x=0
- y=0
- elseif r2maxarl < 100 and x > 59 and x < 78 and y > 18 and y < 20 then
- r2maxarl = r2maxarl + 10
- x=0
- y=0
- elseif r2maxarl > r2minarl and x > 59 and x < 78 and y > 19 and y < 21 then
- r2maxarl = r2maxarl - 10
- x=0
- y=0
- end
- else
- if x > 59 and x < 71 and y > 6 and y < 10 then
- if r2mod == 0 then
- r2mod = 1
- x = 0
- y = 0
- else
- r2mod = 0
- x = 0
- y = 0
- end
- end
- if r2mod == 0 then
- if r2ossz > 0 and x > 59 and x < 63 and y > 10 and y < 14 then
- r2ossz = r2ossz - 10
- x = 0
- y = 0
- elseif r2ossz < 100 and x > 66 and x < 71 and y > 10 and y < 14 then
- r2ossz = r2ossz + 10
- x = 0
- y = 0
- end
- else
- end
- end
- elseif mod == 3 then
- end
- if mod == 1 then
- mon.setCursorPos(3,3)
- mon.setBackgroundColor(colors.lightBlue)
- mon.write(" ")
- mon.setCursorPos(3,4)
- mon.write(" 1-es reaktor ")
- mon.setCursorPos(3,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(3,7)
- mon.write(" ")
- mon.setCursorPos(3,8)
- mon.write(" 2-es reaktor ")
- mon.setCursorPos(3,9)
- mon.write(" ")
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(3,11)
- mon.write(" ")
- mon.setCursorPos(3,12)
- mon.write(" 3-es reaktor ")
- mon.setCursorPos(3,13)
- mon.write(" ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,4)
- mon.write("Allapot: ")
- mon.setCursorPos(36,4)
- if r1.getActive() == true then
- mon.setTextColor(colors.green)
- mon.write("Aktiv")
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.green)
- mon.setCursorPos(60,3)
- mon.write(" ")
- mon.setCursorPos(60,4)
- mon.write(" ON ")
- mon.setCursorPos(60,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.red)
- mon.setCursorPos(72,3)
- mon.write(" ")
- mon.setCursorPos(72,4)
- mon.write(" OFF ")
- mon.setCursorPos(72,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.black)
- else
- mon.setTextColor(colors.red)
- mon.write("Inaktiv")
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.lime)
- mon.setCursorPos(60,3)
- mon.write(" ")
- mon.setCursorPos(60,4)
- mon.write(" ON ")
- mon.setCursorPos(60,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.pink)
- mon.setCursorPos(72,3)
- mon.write(" ")
- mon.setCursorPos(72,4)
- mon.write(" OFF ")
- mon.setCursorPos(72,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.black)
- end
- if automata1 == 0 then
- mon.setCursorPos(25,14)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(25,16)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,15)
- mon.write("Energia min: "..math.floor(r1min/1000000).." mRF")
- mon.setCursorPos(25,18)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(25,20)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,19)
- mon.write("Rodok szintje: "..r1minarl.."%")
- mon.setCursorPos(60,14)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(60,16)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(60,15)
- mon.write("Energia max: "..math.floor(r1max/1000000).." mRF")
- mon.setCursorPos(60,18)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(60,20)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(60,19)
- mon.write("Rodok szintje: "..r1maxarl.."%")
- else
- mon.setCursorPos(60,7)
- mon.setBackgroundColor(colors.blue)
- mon.write(" ")
- mon.setCursorPos(60,9)
- mon.write(" ")
- mon.setCursorPos(60,8)
- if r1mod == 0 then
- mon.write(" OSSZES ")
- mon.setCursorPos(60,11)
- mon.write(" ")
- mon.setCursorPos(60,13)
- mon.write(" ")
- mon.setCursorPos(60,12)
- mon.write(" - ")
- mon.setCursorPos(67,11)
- mon.write(" ")
- mon.setCursorPos(67,13)
- mon.write(" ")
- mon.setCursorPos(67,12)
- mon.write(" + ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(64,12)
- mon.write(r1ossz.."%")
- r1.setAllControlRodLevels(r1ossz)
- else
- mon.write(" KULON ")
- end
- end
- mon.setCursorPos(72,7)
- mon.setBackgroundColor(colors.blue)
- mon.write(" ")
- mon.setCursorPos(72,9)
- mon.write(" ")
- mon.setCursorPos(72,8)
- if automata1 == 0 then
- mon.write(" AUTOMATA ")
- elseif automata1 == 1 then
- mon.write(" MANUAL ")
- end
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,5)
- mon.write("Yellorium:")
- mon.setCursorPos(35,5)
- if r1.getFuelAmount() < 35000 then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.green)
- end
- mon.write(" "..r1.getFuelAmount().." mB")
- mon.setTextColor(colors.white)
- mon.setCursorPos(25,7)
- mon.write("Energia:")
- mon.setCursorPos(25,9)
- mon.write("Tarolt: "..(math.floor(r1.getEnergyStored()/10000)/100).." mRF")
- mon.setCursorPos(25,10)
- mon.write("Termelt: "..math.floor(r1.getEnergyProducedLastTick()).." RF/t")
- mon.setCursorPos(25,23)
- mon.write("0. rod: ")
- drawLine(27,25,10,2,colors.gray)
- drawLine(27,25,math.floor(r1.getControlRodLevel(0)/10),2,colors.yellow)
- mon.setCursorPos(26,37)
- mon.write(r1.getControlRodLevel(0).." %")
- mon.setCursorPos(38,23)
- mon.write("1. rod: ")
- drawLine(40,25,10,2,colors.gray)
- drawLine(40,25,math.floor(r1.getControlRodLevel(1)/10),2,colors.yellow)
- mon.setCursorPos(39,37)
- mon.write(r1.getControlRodLevel(1).." %")
- mon.setCursorPos(51,23)
- mon.write("2. rod: ")
- drawLine(53,25,10,2,colors.gray)
- drawLine(53,25,math.floor(r1.getControlRodLevel(2)/10),2,colors.yellow)
- mon.setCursorPos(52,37)
- mon.write(r1.getControlRodLevel(2).." %")
- mon.setCursorPos(64,23)
- mon.write("3. rod: ")
- drawLine(66,25,10,2,colors.gray)
- drawLine(66,25,math.floor(r1.getControlRodLevel(3)/10),2,colors.yellow)
- mon.setCursorPos(65,37)
- mon.write(r1.getControlRodLevel(3).." %")
- mon.setCursorPos(77,23)
- mon.write("4. rod: ")
- drawLine(79,25,10,2,colors.gray)
- drawLine(79,25,math.floor(r1.getControlRodLevel(4)/10),2,colors.yellow)
- mon.setCursorPos(78,37)
- mon.write(r1.getControlRodLevel(4).." %")
- mon.setBackgroundColor(colors.black)
- elseif mod == 2 then
- mon.setCursorPos(3,3)
- mon.setBackgroundColor(colors.blue)
- mon.write(" ")
- mon.setCursorPos(3,4)
- mon.write(" 1-es reaktor ")
- mon.setCursorPos(3,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.lightBlue)
- mon.setCursorPos(3,7)
- mon.write(" ")
- mon.setCursorPos(3,8)
- mon.write(" 2-es reaktor ")
- mon.setCursorPos(3,9)
- mon.write(" ")
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(3,11)
- mon.write(" ")
- mon.setCursorPos(3,12)
- mon.write(" 3-es reaktor ")
- mon.setCursorPos(3,13)
- mon.write(" ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,4)
- mon.write("Allapot: ")
- mon.setCursorPos(36,4)
- if r2.getActive() == true then
- mon.setTextColor(colors.green)
- mon.write("Aktiv")
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.green)
- mon.setCursorPos(60,3)
- mon.write(" ")
- mon.setCursorPos(60,4)
- mon.write(" ON ")
- mon.setCursorPos(60,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.red)
- mon.setCursorPos(72,3)
- mon.write(" ")
- mon.setCursorPos(72,4)
- mon.write(" OFF ")
- mon.setCursorPos(72,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.black)
- else
- mon.setTextColor(colors.red)
- mon.write("Inaktiv")
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.lime)
- mon.setCursorPos(60,3)
- mon.write(" ")
- mon.setCursorPos(60,4)
- mon.write(" ON ")
- mon.setCursorPos(60,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.pink)
- mon.setCursorPos(72,3)
- mon.write(" ")
- mon.setCursorPos(72,4)
- mon.write(" OFF ")
- mon.setCursorPos(72,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.black)
- end
- if automata2 == 0 then
- mon.setCursorPos(25,14)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(25,16)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,15)
- mon.write("Energia min: "..math.floor(r2min/1000000).." mRF")
- mon.setCursorPos(25,18)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(25,20)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,19)
- mon.write("Rodok szintje: "..r2minarl.."%")
- mon.setCursorPos(60,14)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(60,16)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(60,15)
- mon.write("Energia max: "..math.floor(r2max/1000000).." mRF")
- mon.setCursorPos(60,18)
- mon.setBackgroundColor(colors.blue)
- mon.write(" +++ ")
- mon.setCursorPos(60,20)
- mon.write(" --- ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(60,19)
- mon.write("Rodok szintje: "..r2maxarl.."%")
- else
- mon.setCursorPos(60,7)
- mon.setBackgroundColor(colors.blue)
- mon.write(" ")
- mon.setCursorPos(60,9)
- mon.write(" ")
- mon.setCursorPos(60,8)
- if r2mod == 0 then
- mon.write(" OSSZES ")
- mon.setCursorPos(60,11)
- mon.write(" ")
- mon.setCursorPos(60,13)
- mon.write(" ")
- mon.setCursorPos(60,12)
- mon.write(" - ")
- mon.setCursorPos(67,11)
- mon.write(" ")
- mon.setCursorPos(67,13)
- mon.write(" ")
- mon.setCursorPos(67,12)
- mon.write(" + ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(64,12)
- mon.write(r2ossz.."%")
- r2.setAllControlRodLevels(r2ossz)
- else
- mon.write(" KULON ")
- end
- end
- mon.setCursorPos(72,7)
- mon.setBackgroundColor(colors.blue)
- mon.write(" ")
- mon.setCursorPos(72,9)
- mon.write(" ")
- mon.setCursorPos(72,8)
- if automata2 == 0 then
- mon.write(" AUTOMATA ")
- elseif automata2 == 1 then
- mon.write(" MANUAL ")
- end
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,5)
- mon.write("Blutonium:")
- mon.setCursorPos(35,5)
- if r2.getFuelAmount() < 35000 then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.green)
- end
- mon.write(" "..r2.getFuelAmount().." mB")
- mon.setTextColor(colors.white)
- mon.setCursorPos(25,7)
- mon.write("Energia:")
- mon.setCursorPos(25,9)
- mon.write("Tarolt: "..(math.floor(r2.getEnergyStored()/10000)/100).." mRF")
- mon.setCursorPos(25,10)
- mon.write("Termelt: "..math.floor(r2.getEnergyProducedLastTick()).." RF/t")
- mon.setCursorPos(25,23)
- mon.write("0. rod: ")
- drawLine(27,25,10,2,colors.gray)
- drawLine(27,25,math.floor(r2.getControlRodLevel(0)/10),2,colors.yellow)
- mon.setCursorPos(26,37)
- mon.write(r2.getControlRodLevel(0).." %")
- mon.setCursorPos(38,23)
- mon.write("1. rod: ")
- drawLine(40,25,10,2,colors.gray)
- drawLine(40,25,math.floor(r2.getControlRodLevel(1)/10),2,colors.yellow)
- mon.setCursorPos(39,37)
- mon.write(r2.getControlRodLevel(1).." %")
- mon.setCursorPos(51,23)
- mon.write("2. rod: ")
- drawLine(53,25,10,2,colors.gray)
- drawLine(53,25,math.floor(r2.getControlRodLevel(2)/10),2,colors.yellow)
- mon.setCursorPos(52,37)
- mon.write(r2.getControlRodLevel(2).." %")
- mon.setCursorPos(64,23)
- mon.write("3. rod: ")
- drawLine(66,25,10,2,colors.gray)
- drawLine(66,25,math.floor(r2.getControlRodLevel(3)/10),2,colors.yellow)
- mon.setCursorPos(65,37)
- mon.write(r2.getControlRodLevel(3).." %")
- mon.setCursorPos(77,23)
- mon.write("4. rod: ")
- drawLine(79,25,10,2,colors.gray)
- drawLine(79,25,math.floor(r2.getControlRodLevel(4)/10),2,colors.yellow)
- mon.setCursorPos(78,37)
- mon.write(r2.getControlRodLevel(4).." %")
- mon.setBackgroundColor(colors.black)
- elseif mod == 3 then
- mon.setCursorPos(3,3)
- mon.setBackgroundColor(colors.blue)
- mon.write(" ")
- mon.setCursorPos(3,4)
- mon.write(" 1-es reaktor ")
- mon.setCursorPos(3,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(3,7)
- mon.write(" ")
- mon.setCursorPos(3,8)
- mon.write(" 2-es reaktor ")
- mon.setCursorPos(3,9)
- mon.write(" ")
- mon.setBackgroundColor(colors.lightBlue)
- mon.setCursorPos(3,11)
- mon.write(" ")
- mon.setCursorPos(3,12)
- mon.write(" 3-es reaktor ")
- mon.setCursorPos(3,13)
- mon.write(" ")
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(25,4)
- mon.write("Allapot: ")
- mon.setCursorPos(36,4)
- if r3.getActive() == true then
- mon.setTextColor(colors.green)
- mon.write("Aktiv")
- mon.setTextColor(colors.white)
- else
- mon.setTextColor(colors.red)
- mon.write("Inaktiv")
- mon.setTextColor(colors.white)
- end
- mon.setCursorPos(25,5)
- mon.write("Yellorium:")
- mon.setCursorPos(35,5)
- if r3.getFuelAmount() < 35000 then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.green)
- end
- mon.write(" "..r3.getFuelAmount().." mB")
- mon.setTextColor(colors.white)
- mon.setCursorPos(25,7)
- mon.write("Energia:")
- mon.setCursorPos(25,9)
- mon.write("Tarolt: "..(math.floor(r3.getEnergyStored()/10000)/100).." mRF")
- mon.setCursorPos(25,10)
- mon.write("Termelt: "..math.floor(r3.getEnergyProducedLastTick()).." RF/t")
- mon.setCursorPos(25,12)
- mon.write("Control rodok: "..r3.getControlRodLevel(0).." %")
- end
- if automata1 == 0 then
- if r1.getEnergyStored() >= r1max then
- r1.setAllControlRodLevels(r1maxarl)
- elseif r1.getEnergyStored() <= r1min then
- r1.setAllControlRodLevels(r1minarl)
- end
- end
- if automata2 == 0 then
- if r2.getEnergyStored() >= r2max then
- r2.setAllControlRodLevels(r2maxarl)
- elseif r2.getEnergyStored() <= r2min then
- r2.setAllControlRodLevels(r2minarl)
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- print(mod)
- sleep(1)
- end
- while true do
- parallel.waitForAny(click,futas)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement