SteinScheisser

turbine 3sec

Aug 22nd, 2017
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.94 KB | None | 0 0
  1. -----BigReactor Control
  2. -----by jaranvil aka jared314
  3.  
  4. -----feel free to use and/or mondify this code
  5. -----------------------------------------------
  6.  
  7. version = 1
  8. term.clear()
  9. -------------------FORMATTING-------------------------------
  10. function clear()
  11.         mon.setBackgroundColor(colors.black)
  12.         mon.clear()
  13.         mon.setCursorPos(1,1)
  14. end
  15.  
  16. function draw_text_term(x, y, text, text_color, bg_color)
  17.         term.setTextColor(text_color)
  18.         term.setBackgroundColor(bg_color)
  19.         term.setCursorPos(x,y)
  20.         write(text)
  21. end
  22.  
  23. function draw_text(x, y, text, text_color, bg_color)
  24.         mon.setBackgroundColor(bg_color)
  25.         mon.setTextColor(text_color)
  26.         mon.setCursorPos(x,y)
  27.         mon.write(text)
  28. end
  29.  
  30. function draw_line(x, y, length, color)
  31.                 mon.setBackgroundColor(color)
  32.                 mon.setCursorPos(x,y)
  33.                 mon.write(string.rep(" ", length))
  34. end
  35.  
  36. function draw_line_term(x, y, length, color)
  37.                 term.setBackgroundColor(color)
  38.                 term.setCursorPos(x,y)
  39.                 term.write(string.rep(" ", length))
  40. end
  41.  
  42. function progress_bar(x, y, length, minVal, maxVal, bar_color, bg_color)
  43.         draw_line(x, y, length, bg_color) --backgoround bar
  44.         local barSize = math.floor((minVal/maxVal) * length)
  45.         draw_line(x, y, barSize, bar_color)     --progress so far
  46. end
  47.  
  48. function progress_bar_term(x, y, length, minVal, maxVal, bar_color, bg_color)
  49.         draw_line_term(x, y, length, bg_color) --backgoround bar
  50.         local barSize = math.floor((minVal/maxVal) * length)
  51.         draw_line_term(x, y, barSize, bar_color)        --progress so far
  52. end
  53.  
  54. function button(x, y, length, text, txt_color, bg_color)
  55.         draw_line(x, y, length, bg_color)
  56.         draw_text((x+2), y, text, txt_color, bg_color)
  57. end
  58.  
  59. function menu_bar()
  60.         draw_line(1, 1, monX, colors.blue)
  61.         draw_text(2, 1, "Power    Tools    Settings", colors.white, colors.blue)
  62.         draw_line(1, 19, monX, colors.blue)
  63.         draw_text(2, 19, "     Turbine Control", colors.white, colors.blue)
  64. end
  65.  
  66. function power_menu()
  67.         draw_line(1, 2, 9, colors.gray)
  68.         draw_line(1, 3, 9, colors.gray)
  69.         if active then
  70.                 draw_text(2, 2, "ON", colors.lightGray, colors.gray)
  71.                 draw_text(2, 3, "OFF", colors.white, colors.gray)
  72.         else
  73.                 draw_text(2, 2, "ON", colors.white, colors.gray)
  74.                 draw_text(2, 3, "OFF", colors.lightGray, colors.gray)
  75.         end
  76. end
  77.  
  78. function tools_menu()
  79.         draw_line(10, 2, 14, colors.gray)
  80.         draw_line(10, 3, 14, colors.gray)
  81.         draw_text(11, 2, "Flow Rate", colors.white, colors.gray)
  82.         draw_text(11, 3, "Coils", colors.white, colors.gray)
  83.        
  84.        
  85. end
  86.  
  87. function settings_menu()
  88.         draw_line(12, 2, 18, colors.gray)
  89.         draw_line(12, 3, 18, colors.gray)
  90.         draw_text(13, 2, "Check for Updates", colors.white, colors.gray)
  91.         draw_text(13, 3, "Reset peripherals", colors.white, colors.gray)
  92. end
  93.  
  94. function popup_screen(y, title, height)
  95.         clear()
  96.         menu_bar()
  97.  
  98.         draw_line(4, y, 22, colors.blue)
  99.         draw_line(25, y, 1, colors.red)
  100.  
  101.         for counter = y+1, height+y do
  102.                 draw_line(4, counter, 22, colors.white)
  103.         end
  104.  
  105.         draw_text(25, y, "X", colors.white, colors.red)
  106.         draw_text(5, y, title, colors.white, colors.blue)
  107. end
  108.  
  109. function save_config()
  110.         sw = fs.open("turbine_config.txt", "w")        
  111.                 sw.writeLine(version)
  112.                 sw.writeLine(side)
  113.                 sw.writeLine(name)
  114.                 sw.writeLine(auto_string)
  115.                 sw.writeLine(on)
  116.                 sw.writeLine(off)
  117.         sw.close()
  118. end
  119.  
  120. function load_config()
  121.         sr = fs.open("turbine_config.txt", "r")
  122.                 version = tonumber(sr.readLine())
  123.                 side = sr.readLine()
  124.                 name = sr.readLine()
  125.                 auto_string = sr.readLine()
  126.                 on = tonumber(sr.readLine())
  127.                 off = tonumber(sr.readLine())
  128.         sr.close()
  129. end
  130.  
  131. --------------------------------------------------
  132.  
  133.  
  134.  
  135. function homepage()
  136.         while true do
  137.                 clear()
  138.                 menu_bar()
  139.                 terminal_screen()
  140.  
  141.                 active = turbine.getActive()
  142.                 energy_stored = turbine.getEnergyStored()
  143.                
  144.  
  145.                 --------POWER STAT--------------
  146.                 draw_text(2, 3, "Power: ", colors.yellow, colors.black)
  147.                
  148.                 if active then
  149.                         draw_text(10, 3, "ONLINE", colors.lime, colors.black)
  150.                 else
  151.                         draw_text(10, 3, "OFFLINE", colors.red, colors.black)
  152.                 end
  153.  
  154.  
  155.                 -----------Router speed---------------------
  156.                 draw_text(2, 5, "Router Speed: ", colors.yellow, colors.black)
  157.                 local maxVal = 2000
  158.                 local minVal = math.floor(turbine.getRotorSpeed())
  159.                 draw_text(19, 5, minVal.." rpm", colors.white, colors.black)
  160.  
  161.                 if minVal < 700 then
  162.                 progress_bar(2, 6, monX-2, minVal, maxVal, colors.lightBlue, colors.gray)
  163.                 else if minVal < 900 then      
  164.                 progress_bar(2, 6, monX-2, minVal, maxVal, colors.lime, colors.gray)
  165.                 else if minVal < 1700 then
  166.                 progress_bar(2, 6, monX-2, minVal, maxVal, colors.lightBlue, colors.gray)
  167.                 else if minVal < 1900 then
  168.                 progress_bar(2, 6, monX-2, minVal, maxVal, colors.lime, colors.gray)
  169.                 else if minVal < 2000 then
  170.                 progress_bar(2, 6, monX-2, minVal, maxVal, colors.yellow, colors.gray)
  171.                 else if minVal >= 2000 then
  172.                 progress_bar(2, 6, monX-2, minVal, maxVal, colors.red, colors.gray)
  173.                 end
  174.                 end
  175.                 end
  176.                 end
  177.                 end
  178.                 end
  179.  
  180.                 -----------Steam Level---------------------
  181.                 draw_text(2, 8, "Steam Amount: ", colors.yellow, colors.black)
  182.                 local maxVal = 4000
  183.                 local minVal = math.floor(turbine.getInputAmount())
  184.                 draw_text(19, 8, minVal.." mB", colors.white, colors.black)
  185.                 progress_bar(2, 9, monX-2, minVal, maxVal, colors.lightGray, colors.gray)
  186.                
  187.  
  188.                 -----------Water Level---------------------
  189.                 draw_text(2, 11, "Water Amount: ", colors.yellow, colors.black)
  190.                 local maxVal = 4000
  191.                 local minVal = math.floor(turbine.getOutputAmount())
  192.                 draw_text(19, 11, minVal.." mB", colors.white, colors.black)
  193.                 progress_bar(2, 12, monX-2, minVal, maxVal, colors.blue, colors.gray)
  194.        
  195.  
  196.                 -------------OUTPUT-------------------
  197.                 draw_text(2, 14, "RF/tick: ", colors.yellow, colors.black)
  198.                 rft = math.floor(turbine.getEnergyProducedLastTick())
  199.                 draw_text(19, 14, rft.." RF/T", colors.white, colors.black)
  200.  
  201.                 -----------RF STORAGE---------------
  202.                 draw_text(2, 15, "RF Stored:", colors.yellow, colors.black)
  203.                 local maxVal = 1000000
  204.                 local minVal = energy_stored
  205.                 local percent = math.floor((energy_stored/maxVal)*100)
  206.                 draw_text(19, 15, percent.."%", colors.white, colors.black)
  207.  
  208.                 ------------FLOW RATE----------------
  209.                 draw_text(2, 16, "Flow Rate: ", colors.yellow, colors.black)
  210.                 flow_rate = turbine.getFluidFlowRateMax()
  211.                 draw_text(19, 16, flow_rate.." mB/t", colors.white, colors.black)
  212.  
  213.                 ------------COILS---------------------------
  214.                 engaged = turbine.getInductorEngaged()
  215.                 draw_text(2, 17, "Coils: ", colors.yellow, colors.black)
  216.  
  217.                 if engaged then
  218.                         draw_text(19, 17, "Engaged", colors.white, colors.black)
  219.                 else
  220.                         draw_text(19, 17, "Disengaged", colors.white, colors.black)
  221.                 end
  222.  
  223.  
  224.                
  225.                 sleep(3)
  226.         end
  227. end
  228.  
  229. --------------MENU SCREENS--------------
  230.  
  231.  
  232.  
  233. -------------------Tools----------------------
  234.  
  235. function flow_rate_menu()
  236.         popup_screen(3, "Flow Rate", 12)
  237.         flow_rate = turbine.getFluidFlowRateMax()
  238.         current_flow = turbine.getFluidFlowRate()
  239.  
  240.         draw_text(5, 5, "Steam consumption", colors.lime, colors.white)
  241.         draw_text(5, 6, "last tick:", colors.lime, colors.white)
  242.         draw_text(13, 8, current_flow.." mB", colors.black, colors.white)
  243.  
  244.         draw_text(5, 10, "Flow Rate Setting:", colors.lime, colors.white)
  245.         draw_text(8, 12, " < ", colors.white, colors.black)
  246.         draw_text(13, 12, flow_rate.." mB", colors.black, colors.white)
  247.         draw_text(21, 12, " > ", colors.white, colors.black)
  248.  
  249.         draw_text(13, 14, " Okay ", colors.white, colors.black)
  250.  
  251.         local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  252.  
  253.         --decrease
  254.         if yPos == 12 and xPos >= 8 and xPos <= 11 then
  255.                 turbine.setFluidFlowRateMax(flow_rate-10)
  256.                 flow_rate_menu()
  257.         --increase
  258.         else if yPos == 12 and xPos >= 21 and xPos <= 24 then
  259.                 turbine.setFluidFlowRateMax(flow_rate+10)
  260.                 flow_rate_menu()
  261.         end
  262.         end
  263.  
  264.         --Okay button
  265.         if yPos == 14 and xPos >= 13 and xPos <= 19 then
  266.                 call_homepage()
  267.         end
  268.  
  269.         --Exit button
  270.         if yPos == 3 and xPos == 25 then
  271.                 call_homepage()
  272.         end
  273.         flow_rate_menu()
  274. end
  275.  
  276.  
  277. function coil_menu()
  278.         engaged = turbine.getInductorEngaged()
  279.  
  280.         popup_screen(3, "Induction Coils", 8)
  281.         draw_text(5, 5, "Coil Status:", colors.black, colors.white)
  282.  
  283.         if engaged then
  284.                 draw_text(5, 6, "Engaged", colors.lime, colors.white)
  285.                 draw_text(10, 8, " Disengage ", colors.white, colors.black)
  286.         else
  287.                 draw_text(5, 6, "Disengaged", colors.red, colors.white)
  288.                 draw_text(10, 8, " Engage ", colors.white, colors.black)
  289.         end
  290.  
  291.         draw_text(12, 10, " Okay ", colors.white, colors.black)
  292.  
  293.  
  294.         local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  295.  
  296.         if yPos == 8 and xPos >= 10 and xPos <= 21 then
  297.                 if engaged then
  298.                         turbine.setInductorEngaged(false)
  299.                         coil_menu()
  300.                 else
  301.                         turbine.setInductorEngaged(true)
  302.                         coil_menu()
  303.                 end
  304.         end
  305.  
  306.         --okay button
  307.         if yPos == 10 and xPos >= 12 and xPos <= 18 then
  308.                 call_homepage()
  309.         end
  310.  
  311.  
  312.         coil_menu()
  313. end
  314.  
  315. -----------------------Settings--------------------------------
  316.  
  317.  
  318.  
  319. function install_update(program, pastebin)
  320.                 clear()
  321.                 draw_line(4, 5, 22, colors.blue)
  322.  
  323.                 for counter = 6, 10 do
  324.                         draw_line(4, counter, 22, colors.white)
  325.                 end
  326.  
  327.                 draw_text(5, 5, "Updating...", colors.white, colors.blue)
  328.                 draw_text(5, 7, "Open computer", colors.black, colors.white)
  329.                 draw_text(5, 8, "terminal.", colors.black, colors.white)
  330.  
  331.                 if fs.exists("install") then fs.delete("install") end
  332.                 shell.run("pastebin get p4zeq7Ma install")
  333.                 shell.run("install")
  334.  
  335. end
  336.  
  337. function update()
  338.         popup_screen(5, "Updates", 4)
  339.         draw_text(5, 7, "Connecting to", colors.black, colors.white)
  340.         draw_text(5, 8, "pastebin...", colors.black, colors.white)
  341.  
  342.         sleep(3)
  343.        
  344.         shell.run("pastebin get QP3qrzNu current_version.txt")
  345.         sr = fs.open("current_version.txt", "r")
  346.         current_version = tonumber(sr.readLine())
  347.         sr.close()
  348.         fs.delete("current_version.txt")
  349.         terminal_screen()
  350.  
  351.         if current_version > version then
  352.  
  353.                 popup_screen(5, "Updates", 7)
  354.                 draw_text(5, 7, "Update Available!", colors.black, colors.white)
  355.                 draw_text(11, 9, " Intall ", colors.white, colors.black)
  356.                 draw_text(11, 11, " Ignore ", colors.white, colors.black)
  357.  
  358.                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  359.  
  360.                 --Instatll button
  361.                 if yPos == 9 and xPos >= 11 and xPos <= 17 then
  362.                         install_update()
  363.                 end
  364.  
  365.                 --Exit button
  366.                 if yPos == 5 and xPos == 25 then
  367.                         call_homepage()
  368.                 end
  369.                 call_homepage()
  370.  
  371.         else
  372.                 popup_screen(5, "Updates", 5)
  373.                 draw_text(5, 7, "You are up to date!", colors.black, colors.white)
  374.                 draw_text(11, 9, " Okay ", colors.white, colors.black)
  375.  
  376.                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  377.  
  378.                 --Okay button
  379.                 if yPos == 9 and xPos >= 11 and xPos <= 17 then
  380.                         call_homepage()
  381.                 end
  382.  
  383.                 --Exit button
  384.                 if yPos == 5 and xPos == 25 then
  385.                         call_homepage()
  386.                 end
  387.                 call_homepage()
  388.         end
  389.  
  390.        
  391.  
  392. end
  393.  
  394. function reset_peripherals()
  395.         clear()
  396.         draw_line(4, 5, 22, colors.blue)
  397.  
  398.         for counter = 6, 10 do
  399.                 draw_line(4, counter, 22, colors.white)
  400.         end
  401.  
  402.         draw_text(5, 5, "Reset Peripherals", colors.white, colors.blue)
  403.         draw_text(5, 7, "Open computer", colors.black, colors.white)
  404.         draw_text(5, 8, "terminal.", colors.black, colors.white)
  405.         setup_wizard()
  406.  
  407. end
  408.  
  409. --stop running status screen if monitors was touched
  410. function stop()
  411.         while true do
  412.                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  413.                         x = xPos
  414.                         y = yPos
  415.                         stop_function = "monitor_touch"
  416.                 return
  417.         end    
  418. end
  419.  
  420. function mon_touch()
  421.         --when the monitor is touch on the homepage
  422.         if y == 1 then
  423.                         if x < monX/3 then
  424.                                 power_menu()
  425.                                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  426.                                 if xPos < 9 then
  427.                                         if yPos == 2 then
  428.                                                 turbine.setActive(true)
  429.                                                 call_homepage()
  430.                                         else if yPos == 3 then
  431.                                                 turbine.setActive(false)
  432.                                                 call_homepage()
  433.                                         else
  434.                                                 call_homepage()
  435.                                         end
  436.                                         end
  437.                                 else
  438.                                         call_homepage()
  439.                                 end
  440.                                
  441.                         else if x < 20 then
  442.                                 tools_menu()
  443.                                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  444.                                 if xPos < 25 and xPos > 10 then
  445.                                         if yPos == 2 then
  446.                                                 flow_rate_menu()
  447.                                         else if yPos == 3 then
  448.                                                 coil_menu()
  449.                                         else if yPos == 4 then
  450.                                                
  451.                                         else if yPos == 5 then
  452.                                        
  453.                                         else
  454.                                                 call_homepage()
  455.                                         end
  456.                                         end
  457.                                         end
  458.                                         end
  459.                                 else
  460.                                         call_homepage()
  461.                                 end
  462.                         else if x < monX then
  463.                                 settings_menu()
  464.                                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  465.                                 if xPos > 13 then
  466.                                         if yPos == 2 then
  467.                                                 update()
  468.                                         else if yPos == 3 then
  469.                                                 reset_peripherals()    
  470.                                         else
  471.                                                 call_homepage()
  472.                                         end
  473.                                         end
  474.                                 else
  475.                                         call_homepage()
  476.                                 end
  477.                         end
  478.                         end
  479.                         end
  480.                 else
  481.                         call_homepage()
  482.                 end
  483. end
  484.  
  485. function terminal_screen()
  486.         term.clear()
  487.         draw_line_term(1, 1, 55, colors.blue)
  488.         draw_text_term(13, 1, "BigReactor Controls", colors.white, colors.blue)
  489.         draw_line_term(1, 19, 55, colors.blue)
  490.         draw_text_term(13, 19, "by jaranvil aka jared314", colors.white, colors.blue)
  491.  
  492.         draw_text_term(1, 3, "Current program:", colors.white, colors.black)
  493.         draw_text_term(1, 4, "Turbine Control v"..version, colors.blue, colors.black)
  494.        
  495.         draw_text_term(1, 6, "Installer:", colors.white, colors.black)
  496.         draw_text_term(1, 7, "pastebin.com/p4zeq7Ma", colors.blue, colors.black)
  497.  
  498.         draw_text_term(1, 9, "Please give me your feedback, suggestions,", colors.white, colors.black)
  499.         draw_text_term(1, 10, "and errors!", colors.white, colors.black)
  500.  
  501.         draw_text_term(1, 11, "reddit.com/r/br_controls", colors.blue, colors.black)
  502. end
  503.  
  504. --run both homepage() and stop() until one returns
  505. function call_homepage()
  506.         clear()
  507.         parallel.waitForAny(homepage, stop)
  508.  
  509.         if stop_function == "terminal_screen" then
  510.                 stop_function = "nothing"
  511.                 setup_wizard()
  512.         else if stop_function == "monitor_touch" then
  513.                 stop_function = "nothing"
  514.                 mon_touch()
  515.         end
  516.         end
  517. end
  518.  
  519. --try to wrap peripherals
  520. --catch any errors
  521.         function test_turbine_connection()
  522.                 turbine = peripheral.wrap(name)  --wrap reactor
  523.                 c = turbine.getConnected()
  524.             if unexpected_condition then error() end  
  525.         end
  526.  
  527.         function test_monitor_connection()
  528.                 mon = peripheral.wrap(side) --wrap mon
  529.                 monX, monY = mon.getSize() --get mon size ()
  530.             if unexpected_condition then error() end  
  531.         end
  532.  
  533. --test if the entered monitor and reactor can be wrapped
  534.         function test_configs()
  535.  
  536.                 term.clear()
  537.                 draw_line_term(1, 1, 55, colors.blue)
  538.                 draw_text_term(10, 1, "BigReactor Controls v"..version, colors.white, colors.blue)
  539.                 draw_line_term(1, 19, 55, colors.blue)
  540.                 draw_text_term(10, 19, "by jaranvil aka jared314", colors.white, colors.blue)
  541.  
  542.                 draw_text_term(1, 3, "Wrapping peripherals...", colors.blue, colors.black)
  543.                 draw_text_term(2, 5, "wrap montior...", colors.white, colors.black)
  544.                 sleep(3)
  545.                 if pcall(test_monitor_connection) then
  546.                         draw_text_term(18, 5, "success", colors.lime, colors.black)
  547.                 else
  548.                         draw_text_term(1, 4, "Error:", colors.red, colors.black)
  549.                         draw_text_term(1, 8, "Could not connect to monitor on "..side.." side", colors.red, colors.black)
  550.                         draw_text_term(1, 9, "Valid sides are 'left', 'right', 'top', 'bottom' and 'back'", colors.white, colors.black)
  551.                         draw_text_term(1, 11, "Press Enter to continue...", colors.gray, colors.black)
  552.                         wait = read()
  553.                         setup_wizard()
  554.                 end
  555.                 sleep(3)
  556.                 draw_text_term(2, 6, "wrap turbine...", colors.white, colors.black)
  557.                 sleep(3)
  558.                 if pcall(test_turbine_connection) then
  559.                         draw_text_term(18, 6, "success", colors.lime, colors.black)
  560.                 else
  561.                         draw_text_term(1, 8, "Error:", colors.red, colors.black)
  562.                         draw_text_term(1, 9, "Could not connect to "..name, colors.red, colors.black)
  563.                         draw_text_term(1, 10, "Turbine must be connected with networking cable and wired modem", colors.white, colors.black)
  564.                         draw_text_term(1, 12, "Press Enter to continue...", colors.gray, colors.black)
  565.                         wait = read()
  566.                         setup_wizard()
  567.                 end
  568.                 sleep(3)
  569.                 draw_text_term(2, 8, "saving settings to file...", colors.white, colors.black)
  570.  
  571.                 save_config()
  572.  
  573.                 sleep(3)
  574.                 draw_text_term(1, 10, "Setup Complete!", colors.lime, colors.black)    
  575.                 sleep(3)
  576.  
  577.                 auto = auto_string == "true"
  578.                 call_homepage()
  579.  
  580. end
  581. ----------------SETUP-------------------------------
  582.  
  583. function setup_wizard()
  584.         term.clear()
  585.         draw_text_term(1, 1, "BigReactor Controls v"..version, colors.lime, colors.black)
  586.         draw_text_term(1, 2, "Peripheral setup wizard", colors.white, colors.black)
  587.         draw_text_term(1, 4, "Step 1:", colors.lime, colors.black)
  588.         draw_text_term(1, 5, "-Place 3x3 advanced monitors next to computer.", colors.white, colors.black)
  589.         draw_text_term(1, 7, "Step 2:", colors.lime, colors.black)
  590.         draw_text_term(1, 8, "-Place a wired modem on this computer and on the ", colors.white, colors.black)
  591.         draw_text_term(1, 9, " computer port of the turbine.", colors.white, colors.black)
  592.         draw_text_term(1, 10, "-connect modems with network cable.", colors.white, colors.black)
  593.         draw_text_term(1, 11, "-right click modems to activate.", colors.white, colors.black)
  594.         draw_text_term(1, 13, "Press Enter when ready...", colors.gray, colors.black)
  595.        
  596.         wait = read()
  597.        
  598.         term.clear()
  599.         draw_text_term(1, 1, "Peripheral Setup", colors.lime, colors.black)
  600.         draw_text_term(1, 3, "What side is your monitor on?", colors.yellow, colors.black)
  601.  
  602.         term.setTextColor(colors.white)
  603.         term.setCursorPos(1,4)
  604.         side = read()
  605.  
  606.         term.clear()
  607.         draw_text_term(1, 1, "Peripheral Setup", colors.lime, colors.black)
  608.         draw_text_term(1, 3, "What is the turbine's name?", colors.yellow, colors.black)
  609.         draw_text_term(1, 4, "type 'default' for  'BigReactors-Turbine_0'", colors.gray, colors.black)
  610.  
  611.         term.setTextColor(colors.white)
  612.         term.setCursorPos(1,5)
  613.         name = read()
  614.  
  615.         if name == "default" then name = "BigReactors-Turbine_0" end
  616.         auto_string = false
  617.         on = 0
  618.         off = 99
  619.  
  620.         test_configs()
  621. end
  622.  
  623. function start()
  624.         --if configs exists, load values and test
  625.         if fs.exists("turbine_config.txt") then
  626.                         load_config()
  627.  
  628.                         test_configs()
  629.         else
  630.                 setup_wizard()
  631.         end
  632. end
  633.  
  634. start()
Add Comment
Please, Sign In to add comment