Rieu

Obsidian Generator

May 19th, 2015
742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.94 KB | None | 0 0
  1. --Author: Ferrwolf
  2. -- This program is designed for user to place lava in two 2x18 areas
  3. -- A special thanks to HPWebcamAble and Bomb Bloke. Without their help this project would not be possible.
  4.  
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. print("Welcome to Obsidian generator. To start, Place the turtle at the level you will be making the obsidian facing the area you wish the turtle to make the obsidian. Next place a lava source directly behind and two blocks above the turtle, and place a chest  or barrel on the turtles left side at the same level as your lava source. Place 64 lava cells into slot 1, 13 into slot 2, and 1 water cell in slot 3.")
  8. sleep(10)
  9. print("If you wish to move or are no longer needing the obsidian, have the turtle make one run, replacing the lava cells with the same number of the block of your choice. Keep the water cell in slot 3.")
  10.  
  11. if turtle.getItemCount(1) < 64 then
  12.   term.clear()
  13.   term.setCursorPos(1,5)
  14.   print("Please place 64 lava cells slot 1, 13 lava cells in slot 2, and 1 water cell in slot 3.")
  15.   sleep(2)
  16.   term.clear()
  17.   sleep(1)
  18.   term.setCursorPos(1,5)
  19.   print("Please place 64 lava cells slot 1, 13 lava cells in slot 2, and 1 water cell in slot 3.")
  20.   sleep(2)
  21.   term.clear()
  22.   sleep(1)
  23.   term.setCursorPos(1,5)
  24.   print("Please place 64 lava cells slot 1, 13 lava cells in slot 2, and 1 water cell in slot 3.")
  25.   sleep(2)
  26.   term.clear()
  27.   print("Once you place the items in the correct slots, please start me again.")
  28.   print("Shutting down in 3")
  29.   sleep(2)
  30.   print("2")
  31.   sleep(2)
  32.   print("1")
  33.   sleep(2)
  34.   os.shutdown()
  35. elseif turtle.getItemCount(2) < 13 then
  36.   term.clear()
  37.   term.setCursorPos(1,5)
  38.   print("Please place 13 lava cells in slot 2, and 1 water cell in slot 3.")
  39.   sleep(2)
  40.   term.clear()
  41.   sleep(1)
  42.   term.setCursorPos(1,5)
  43.   print("Please place 13 lava cells in slot 2, and 1 water cell in slot 3.")
  44.   sleep(2)
  45.   term.clear()
  46.   sleep(1)
  47.   term.setCursorPos(1,5)
  48.   print("Please place 13 lava cells in slot 2, and 1 water cell in slot 3.")
  49.   sleep(2)
  50.   term.clear()
  51.   print("Once you place the items in the correct slots, please start me again.")
  52.   print("Shutting down in 3")
  53.   sleep(2)
  54.   print("2")
  55.   sleep(2)
  56.   print("1")
  57.   sleep(2)  
  58.   os.shutdown()
  59.   elseif turtle.getItemCount(3) < 1 then
  60.     term.clear()
  61.     term.setCursorPos(1,5)
  62.     print("Please place 1 water cell in slot 3.")
  63.     sleep(2)
  64.     term.clear()
  65.     sleep(1)
  66.     term.setCursorPos(1,5)
  67.     print("Please place 1 water cell in slot 3.")
  68.     sleep(2)
  69.     term.clear()
  70.     sleep(1)
  71.     term.setCursorPos(1,5)
  72.     print("Please place 1 water cell in slot 3.")
  73.     sleep(2)
  74.     term.clear()
  75.     print("Once you place the items in the correct slots, please start me again.")
  76.     print("Shutting down in 3")
  77.     sleep(2)
  78.     print("2")
  79.     sleep(2)
  80.     print("1")
  81.     sleep(2)  
  82.     os.shutdown()
  83.     elseif turtle.getItemCount(3) > 1 then
  84.       term.clear()
  85.       term.setCursorPos(1,5)
  86.       print("Please place only 1 water cell in slot 3. You have too many!")
  87.       sleep(2)
  88.       term.clear()
  89.       sleep(2)
  90.       term.setCursorPos(1,5)
  91.       print("Please place only 1 water cell in slot 3. You have too many!")
  92.       sleep(2)
  93.       term.clear()
  94.       sleep(2)
  95.       term.setCursorPos(1,5)
  96.       print("Please place only 1 water cell in slot 3. You have too many!")
  97.       sleep(2)
  98.       term.clear()
  99.       print("Once you place the item in the correct slot, please start me again.")
  100.       print("Shutting down in 3")
  101.       sleep(2)
  102.       print("2")
  103.       sleep(2)
  104.       print("1")
  105.       sleep(2)  
  106.       os.shutdown()
  107. end
  108.  
  109. --Requests number of runs from user
  110.  
  111. term.write("How many runs would you like: ")
  112. local runs = tonumber(read())
  113. local counter = 0
  114.  
  115. -- Turtle mines the first row of obsidian
  116.  
  117. while runs > 0 do
  118. runs=runs-1
  119. counter=counter+1
  120. turtle.select(16)
  121. for i=0,18 do
  122.   while not turtle.forward() do
  123.     turtle.attack()
  124.     turtle.dig()
  125.   end
  126. end
  127.  
  128. -- Sets the turtle up to mine the second row
  129.  
  130. turtle.turnRight()
  131. turtle.dig()
  132. while not turtle.forward() do
  133.   turtle.attack()
  134.   turtle.dig()
  135. end
  136. turtle.turnRight()
  137.  
  138. -- Turtle mines the second row
  139.  
  140. for i=0,17 do
  141.   while not turtle.forward() do
  142.     turtle.attack()
  143.     turtle.dig()
  144.   end
  145. end
  146.  
  147. -- Turtle moves the the second plot and prepares to mine the 3rd row
  148.  
  149. turtle.turnLeft()
  150. turtle.dig()
  151. while not turtle.forward() do
  152.     turtle.attack()
  153.     turtle.dig()
  154. end
  155. turtle.dig()
  156. while not turtle.forward() do
  157.     turtle.attack()
  158.     turtle.dig()
  159. end
  160. turtle.turnLeft()
  161.  
  162. -- Turtle mines the 3rd row
  163.  
  164. for i=0,17 do
  165.   while not turtle.forward() do
  166.     turtle.attack()
  167.     turtle.dig()
  168.   end
  169. end
  170.  
  171. -- Turtle prepares to mine 4th row
  172.  
  173. turtle.turnRight()
  174. turtle.dig()
  175. while not turtle.forward() do
  176.     turtle.attack()
  177.     turtle.dig()
  178. end
  179. turtle.turnRight()
  180.  
  181. -- Turtle mines the 4th row
  182.  
  183. for i=0,4 do
  184.   while not turtle.forward() do
  185.     turtle.attack()
  186.     turtle.dig()
  187.   end
  188. end
  189.  
  190. turtle.select(15)
  191.  
  192. for i=0,12 do
  193.   while not turtle.forward() do
  194.     turtle.attack()
  195.     turtle.dig()
  196.   end
  197. end
  198.  
  199. -- Returns turtle to starting point while placing lava
  200.  
  201. turtle.select(1)
  202.  
  203. for i=0,17 do
  204. turtle.back()
  205. turtle.place()
  206. end
  207.  
  208. turtle.turnLeft()
  209. turtle.back()
  210. turtle.place()
  211. turtle.turnLeft()
  212. turtle.back()
  213. turtle.place()
  214.  
  215. for i=0,16 do
  216. turtle.back()
  217. turtle.place()
  218. end
  219.  
  220. turtle.turnRight()
  221. turtle.back()
  222. turtle.place()
  223. turtle.back()
  224. turtle.place()
  225. turtle.turnRight()
  226.  
  227. for i=0,17 do
  228. turtle.back()
  229. turtle.place()
  230. end
  231.  
  232. turtle.turnLeft()
  233. turtle.back()
  234. turtle.place()
  235. turtle.turnLeft()
  236. turtle.back()
  237. turtle.place()
  238.  
  239. for i=0,4 do
  240. turtle.back()
  241. turtle.place()
  242. end
  243.  
  244. turtle.select(2)
  245.  
  246. for i=0,12 do
  247. turtle.back()
  248. turtle.place()
  249. end
  250.  
  251. --Placing water to make obsidian
  252. turtle.select(3)
  253. turtle.up()
  254. turtle.forward()
  255. turtle.turnRight()
  256. turtle.forward()
  257. turtle.forward()
  258. turtle.turnLeft()
  259. turtle.forward()
  260. turtle.forward()
  261. turtle.forward()
  262. turtle.forward()
  263. turtle.place()
  264. sleep(3)
  265. turtle.place()
  266. for i=0,9 do
  267.   turtle.forward()
  268. end
  269. turtle.place()
  270. sleep(3)
  271. turtle.place()
  272. turtle.turnLeft()
  273. turtle.forward()
  274. turtle.forward()
  275. turtle.turnLeft()
  276. for i=0,14 do
  277.   turtle.forward()
  278. end
  279. turtle.up()
  280. turtle.select(1)
  281. turtle.place()
  282. turtle.select(2)
  283. turtle.place()
  284. turtle.select(4)
  285. while turtle.getItemCount(4) > 1 do
  286.   turtle.place()
  287. end
  288. turtle.place()
  289. turtle.select(5)
  290. while turtle.getItemCount(5) > 1 do
  291.   turtle.place()
  292. end
  293. turtle.place()
  294. turtle.select(4)
  295. turtle.transferTo(1)
  296. turtle.select(5)
  297. turtle.transferTo(1)
  298. turtle.select(6)
  299. turtle.transferTo(1)
  300. turtle.transferTo(2)
  301. turtle.select(7)
  302. turtle.transferTo(2)
  303. turtle.turnRight()
  304. turtle.select(16)
  305. turtle.drop()
  306. turtle.select(15)
  307. turtle.drop()
  308. turtle.turnRight()
  309. turtle.down()
  310. turtle.down()
  311. term.clear()
  312. term.setCursorPos(1,1)
  313. print("Run complete!")
  314. end
  315. counter = tostring(counter)
  316. term.write("The turtle has completed ")
  317. term.write(counter)
  318. print(" runs!")
Advertisement
Add Comment
Please, Sign In to add comment