Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if not turtle then
  2.     print("Error Not turtle")
  3.     return
  4. end
  5.  
  6. local mov = {}
  7.  
  8. mov.forward = function ()
  9.     while not turtle.forward() do
  10.         sleep(1)
  11.     end
  12.     return true
  13. end
  14. mov.back = function ()
  15.     while not turtle.back() do
  16.         sleep(1)
  17.     end
  18.     return true
  19. end
  20. mov.up = function ()
  21.     while not turtle.up() do
  22.         sleep(1)
  23.     end
  24.     return true
  25. end
  26. mov.down = function ()
  27.     while not turtle.down() do
  28.         sleep(1)
  29.     end
  30.     return true
  31. end
  32. mov.place = function ()
  33.     while not turtle.place() do
  34.         sleep(1)
  35.     end
  36. end
  37.  
  38. local base = nil
  39.  
  40. if turtle.getFuelLevel() < 600 then
  41.     print("600 fuel is required")
  42.     return
  43. else
  44.     if fs.exists("custom") then
  45.         print("custom program detected")
  46.         print("please Enter base Station number")
  47.         local failFlag = false
  48.         repeat
  49.             if failFlag then
  50.                 print("Error Not number")
  51.                 print("try again")
  52.             end
  53.             write(" > ")
  54.             base = tonumber(read())
  55.             failFlag = true
  56.         until type(base) == "number"
  57.     end
  58.     print("Please Place 4 computers in slot one")
  59.     print("4 modems in slot two")
  60.     print("if mineing turtle then")
  61.     print("1 disk drive in slot three")
  62.     print("if not mineing then")
  63.     print("4 disk drive in slot three")
  64.     print("blank floopy disk in slot four")
  65.     print("press Enter key to continue")
  66.     while true do
  67.         local event , key = os.pullEvent("key")
  68.         if key == 28 then break end
  69.     end
  70.     print("Launching")
  71. end
  72. local set = {}
  73. set[1] = {x = 0,y = 3,z = 254}
  74. set[2] = {x = 3,y = 0,z = 251}
  75. set[3] = {x = 0,y = -3,z = 254}
  76. set[4] = {x = -3,y = 0,z = 251}
  77.  
  78. for a = 1,4 do
  79.     for i = 1,2 do
  80.         mov.forward()
  81.     end
  82.     turtle.select(1)
  83.     mov.place()
  84.     mov.back()
  85.     turtle.select(2)
  86.     mov.place()
  87.     mov.down()
  88.     mov.forward()
  89.     turtle.select(3)
  90.     mov.place()
  91.     turtle.select(4)
  92.     turtle.drop()
  93.     -- make disk custom
  94.     fs.delete("disk/startup")
  95.     file = fs.open("disk/startup","w")
  96.     file.write([[
  97. fs.copy("disk/install","startup")
  98. fs.delete("disk/startup")
  99. if fs.exists("disk/custom") then
  100.     fs.copy("disk/custom","custom")
  101.     fs.delete("disk/custom")
  102. end
  103. print("sleep in 10")
  104. sleep(10)
  105. os.reboot()
  106. ]])
  107.     file.close()
  108.     if fs.exists("custom") then
  109.         fs.copy("custom","disk/custom")
  110.     end
  111.         file = fs.open("disk/install","w")
  112.         file.write([[
  113. if fs.exists("custom") then
  114.     shell.run("custom","host",]]..set[a]["x"]..","..set[a]["y"]..","..set[a]["z"]..","..(base or "nil")..[[)
  115. else
  116.     shell.run("gps","host",]]..set[a]["x"]..","..set[a]["y"]..","..set[a]["z"]..[[)
  117. end
  118. ]])
  119.         file.close()
  120.     -- end make disk custom
  121.     turtle.turnLeft()
  122.     mov.forward()
  123.     mov.up()
  124.     turtle.turnRight()
  125.     mov.forward()
  126.     turtle.turnRight()
  127.     peripheral.call("front","turnOn")
  128.     mov.down()
  129.     turtle.suck()
  130.     turtle.select(3)
  131.     turtle.dig()
  132.     mov.up()
  133.     -- reboot would be here
  134.     turtle.turnRight()
  135.     for i = 1,3 do
  136.         mov.forward()
  137.     end
  138.     turtle.turnLeft()
  139.     mov.forward()
  140.     if a == 1 or a == 3 then
  141.         for i = 1,3 do
  142.         mov.down()
  143.         end
  144.     elseif a == 2 or a == 4 then
  145.         for i = 1,3 do
  146.         mov.up()
  147.         end
  148.     end
  149. end
  150.  
  151. while turtle.down() do -- brings turtle down
  152. end
  153. turtle = tMove
  154. print("Finished")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement