Advertisement
eslusserjr

Pinwheel MinerDraft

Apr 14th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.27 KB | None | 0 0
  1. --Pinwheel Mining is a variation of branch mining designed to maximize time and resources
  2. --define variables
  3. local slot=0
  4. --define functions
  5. --Deliver will empty inventory into chests
  6. function Deliver()
  7.     for drop = 1, 11, 1 do
  8.         slot=slot+1
  9.         turtle.select(slot)
  10.         turtle.drop()
  11.     end
  12. end
  13. --Torch Check will allow two slots with Stacks of torches!!**needs updating for 5 slots
  14. function TorchCheck()
  15.     turtle.select(13)
  16.     if turtle.getitemCount(12) < 1 then
  17.         turtle.transferTo(12)
  18.     end
  19.     turtle.select(14)
  20.     if turtle.getitemCount(13) < 1 then
  21.         turtle.transferTo(13)
  22.     end
  23.     turtle.select(15)
  24.     if turtle.getitemCount(14) < 1 then
  25.         turtle.transferTo(14)
  26.     end
  27.     turtle.select(16)
  28.     if turtle.getitemCount(15) < 1 then
  29.         turtle.transferTo(15)
  30.     end
  31.     turtle.select(12)
  32. end
  33. --spiralStep is the basic unit of spiral mining
  34. function spiralStep()
  35.     if turtle.detectDown()==true then
  36.         turtle.dig()
  37.         turtle.digUp()
  38.         turtle.digDown()
  39.         if turtle.detect()==true then
  40.             turtle.dig()
  41.             turtle.digUp()
  42.             turtle.digDown()
  43.             spiralStep()
  44.         end
  45.         turtle.down()
  46.         turtle.dig()
  47.         turtle.forward()
  48.         turtle.turnLeft()
  49.     else
  50.         turtle.turnLeft()
  51.         for run = 1, 3, 1 do
  52.             turtle.up()
  53.             turtle.forward()
  54.             turtle.turnRight()
  55.         end
  56.         turtle.turnRight()
  57.         turtle.forward()
  58.         turtle.turnLeft()
  59.     end
  60. end
  61. --spiralLevel mines down levels
  62. function spiralLevel()
  63.     turtle.select(12)
  64.     for steps = 1, 5, 1 do
  65.         spiralStep()
  66.     end
  67.     turtle.up()
  68.     turtle.turnLeft()
  69.     turtle.place()
  70.     turtle.turnRight()
  71.     turtle.down()
  72. end
  73. --Mine Step is the building block for the rest of the Script
  74. function Sstep()
  75.     if turtle.detectDown()==false then
  76.         turtle.placeDown()
  77.         turtle.dig()
  78.         turtle.digUp()
  79.         turtle.forward()
  80.     else
  81.         turtle.dig()
  82.         turtle.digUp()
  83.         if turtle.detect()==true then
  84.             turtle.dig()
  85.             turtle.digUp()
  86.             Sstep()
  87.         end
  88.         turtle.forward()
  89.     end
  90. end
  91. --Shaft leg one is for 9 blocks then a torch
  92. function SlegOne()
  93.     TorchCheck()
  94.     for Steps = 1, 9, 1 do
  95.         Sstep()
  96.     end
  97.     turtle.turnLeft()
  98.     turtle.turnLeft()
  99.     turtle.place()
  100.     turtle.turnLeft()
  101.     turtle.turnLeft()
  102. end
  103. --Shaft leg two is for 18 blocks; designed to use in conjunction with leg one and a return trip
  104. function SlegTwo()
  105.     TorchCheck()
  106.     for Steps = 1, 18, 1 do
  107.         Sstep()
  108.     end
  109.     turtle.turnLeft()
  110.     turtle.turnLeft()
  111.     turtle.place()
  112.     turtle.turnLeft()
  113.     turtle.turnLeft()
  114. end
  115. --Main Branch is 2x2x~50
  116. function mBranch()
  117.     SlegOne()
  118.     SlegTwo()
  119.     SlegTwo()
  120.     turtle.turnLeft()
  121.     Sstep()
  122.     turtle.turnLeft()
  123.     SlegOne()
  124.     SlegTwo()
  125.     SlegTwo()
  126. end
  127. --Secondary Branches come off the main branch
  128. function sBranch()
  129.     SlegOne()
  130.     SlegTwo()
  131.     SlegTwo()
  132.     turtle.turnLeft()
  133.     turtle.turnLeft()
  134.     SlegOne()
  135.     SlegTwo()
  136.     SlegTwo()
  137. end
  138. --SecondaryBranchDigging Step
  139. function SBDigStep()
  140.     sBranch()
  141.     turtle.turnRight()
  142.     for move = 1, 4, 1 do
  143.         turtle.forward()
  144.     end
  145.     turtle.turnRight()
  146. end
  147. --Secondary Branch Digging part1of3(SBDigOne) is the function
  148. function SBDigOne()
  149.     turtle.turnRight()
  150.     for SBDO = 1, 3, 1 do
  151.         SBDigStep()
  152.     end
  153.     turtle.turnRight()
  154.     for retu = 1, 8, 1 do
  155.         turtle.forward()
  156.     end
  157. end
  158. --12 Secondary Branch Digging part2of3(SBDigTwo)
  159. function SBDigTwo()
  160.     for SBDTO = 1, 12, 1 do
  161.         turtle.forward()
  162.     end
  163.     turtle.turnRight()
  164.     for SBDTT = 1, 3, 1 do
  165.         SBDigStep()
  166.     end
  167.     turtle.turnRight()
  168.     for retuT = 1, 20, 1 do
  169.         turtle.forward()
  170.     end
  171. end
  172. --24 Secondary Branch Digging part3of3(SBDigThree)
  173. function SBDigThree()
  174.     for SBDThO = 1, 24, 1 do
  175.         turtle.forward()
  176.     end
  177.     turtle.turnRight()
  178.     for SBDThT = 1, 5, 1 do
  179.         SBDigStep()
  180.     end
  181.     turtle.turnRight()
  182.     for retuTh = 1, 43, 1 do
  183.         turtle.forward()
  184.     end
  185. end
  186. --preliminary test of functions
  187. term.clear()
  188. print("Hello World: ")
  189. print("-rim-shot- I'm kidding ")
  190. print("Before I start please load me up ")
  191. --Fuel slot 4, 2 Chests slot 3, Torches slots 12-16
  192. print("I need fuel in slot 4, 2 Chests in ")
  193. print("slot 3, & a stack of torches in  ")
  194. print("slots 12, 13, 14, 15 & 16--I'll need them")
  195. print("Please press enter to continue: ")
  196. local intro = read()
  197. print("Now I need to know how many levels of 5 blocks ")
  198. print("You want me to dig down for the Pinwheel Mine ")
  199. print("If you want to mine at the current level, press 0")
  200. local depth = read()
  201. print("Ok.. ", depth, " levels... let's go")
  202. turtle.select(4)
  203. turtle.refuel()
  204. --if depth => 0 then
  205. for deep = 1, depth, 1 do
  206.     spiralLevel()
  207. end
  208. --end
  209. --Central Chamber
  210. Sstep()
  211. Sstep()
  212. turtle.turnLeft()
  213. Sstep()
  214. Sstep()
  215. turtle.turnLeft()
  216. Sstep()
  217. Sstep()
  218. Sstep()
  219. turtle.turnLeft()
  220. Sstep()
  221. Sstep()
  222. Sstep()
  223. turtle.turnLeft()
  224. for cham1 = 1, 4, 1 do
  225.     Sstep()
  226. end
  227. turtle.turnLeft()
  228. for cham2 = 1, 4, 1 do
  229.     Sstep()
  230. end
  231. turtle.turnLeft()
  232. for cham5 = 1, 3, 1 do
  233.     for cham3 = 1, 5, 1 do
  234.         Sstep()
  235.     end
  236.     turtle.turnLeft()  
  237. end
  238. Sstep()
  239. Sstep()
  240. turtle.turnLeft()
  241. turtle.select(3)
  242. turtle.place()
  243. turtle.turnRight()
  244. turtle.forward()
  245. turtle.turnLeft()
  246. turtle.place()
  247. Deliver()
  248. turtle.turnRight()
  249. turtle.forward()
  250. turtle.forward()
  251. --begin main branches
  252. --Mbranch 3 o'clock from standing in front of chest
  253. mBranch()
  254. turtle.forward()
  255. Deliver()
  256. turtle.turnRight()
  257. turtle.turnRight()
  258. turtle.forward()
  259. turtle.turnLeft()
  260. for twelve = 1, 4, 1 do
  261.     turtle.forward()
  262. end
  263. --Mbranch 12 o'clock from standing in front of chest
  264. mBranch()
  265. for tdOne = 1, 4, 1 do
  266.     turtle.forward()
  267. end
  268. turtle.turnRight()
  269. Deliver()
  270. turtle.turnRight()
  271. for tdmTwo = 1, 4, 1 do
  272.     turtle.forward()
  273. end
  274. turtle.turnLeft()
  275. for nine = 1, 4, 1 do
  276.     turtle.forward()
  277. end
  278. --Mbranch 9 o'clock from standing in front of chest
  279. mBranch()
  280. turtle.turnRight()
  281. for ndmOne = 1, 3, 1 do
  282.     turtle.forward()
  283. end
  284. turtle.turnLeft()
  285. turtle.forward()
  286. Deliver()
  287. turtle.turnRight()
  288. turtle.turnRight()
  289. turtle.forward()
  290. turtle.turnLeft()
  291. turtle.forward()
  292. --Mbranch 6 o'clock from standing in front of chest
  293. mBranch()
  294. turtle.turnLeft()
  295. turtle.forward()
  296. turtle.turnLeft()
  297. --begin secondary branches with 6 oclock Mbranch
  298. SBDigOne()
  299. turtle.forward()
  300. turtle.forward()
  301. turtle.turnRight()
  302. turtle.forward()
  303. Deliver()
  304. turtle.turnRight()
  305. turtle.forward()
  306. turtle.forward()
  307. turtle.turnRight()
  308. turtle.forward()
  309. turtle.turnLeft()
  310. SBDigTwo()
  311. turtle.forward()
  312. turtle.forward()
  313. turtle.turnRight()
  314. turtle.forward()
  315. Deliver()
  316. turtle.turnRight()
  317. turtle.forward()
  318. turtle.forward()
  319. turtle.turnRight()
  320. turtle.forward()
  321. turtle.turnLeft()
  322. SBDigThree()
  323. turtle.forward()
  324. turtle.forward()
  325. turtle.turnRight()
  326. turtle.forward()
  327. Deliver()
  328. turtle.turnLeft()
  329. for next = 1, 4, 1 do
  330.     turtle.forward()
  331. end
  332. turtle.turnLeft()
  333. turtle.forward()
  334. --secondary branches at 9 oclock
  335. SBDigOne()
  336. turtle.turnRight()
  337. for next = 1, 4, 1 do
  338.     turtle.forward()
  339. end
  340. turtle.turnLeft()
  341. turtle.forward()
  342. Deliver()
  343. turtle.turnLeft()
  344. for next = 1, 4, 1 do
  345.     turtle.forward()
  346. end
  347. turtle.turnLeft()
  348. turtle.forward()
  349. SBDigTwo()
  350. turtle.turnRight()
  351. for next = 1, 4, 1 do
  352.     turtle.forward()
  353. end
  354. turtle.turnLeft()
  355. turtle.forward()
  356. Deliver()
  357. turtle.turnLeft()
  358. for next = 1, 4, 1 do
  359.     turtle.forward()
  360. end
  361. turtle.turnLeft()
  362. turtle.forward()
  363. SBDigThree()
  364. turtle.turnRight()
  365. for next = 1, 4, 1 do
  366.     turtle.forward()
  367. end
  368. turtle.turnLeft()
  369. turtle.forward()
  370. Deliver()
  371. turtle.turnLeft()
  372. for next = 1, 4, 1 do
  373.     turtle.forward()
  374. end
  375. turtle.turnRight()
  376. for next = 1, 4, 1 do
  377.     turtle.forward()
  378. end
  379. turtle.turnLeft()
  380. --Secondary branches from 12 oclock
  381. SBDigOne()
  382. for next = 1, 4, 1 do
  383.     turtle.forward()
  384. end
  385. turtle.turnRight()
  386. turtle.forward()
  387. Deliver()
  388. turtle.turnRight()
  389. for next = 1, 4, 1 do
  390.     turtle.forward()
  391. end
  392. turtle.turnRight()
  393. turtle.forward()
  394. turtle.turnLeft()
  395. SBDigTwo()
  396. for next = 1, 4, 1 do
  397.     turtle.forward()
  398. end
  399. turtle.turnRight()
  400. turtle.forward()
  401. Deliver()
  402. turtle.turnRight()
  403. for next = 1, 4, 1 do
  404.     turtle.forward()
  405. end
  406. turtle.turnRight()
  407. turtle.forward()
  408. turtle.turnLeft()
  409. SBDigThree()
  410. for next = 1, 5, 1 do
  411.     turtle.forward()
  412. end
  413. turtle.turnLeft()
  414. --Secondary Branches 3oclock
  415. SBDigOne()
  416. turtle.forward()
  417. turtle.forward()
  418. turtle.turnLeft()
  419. turtle.foward()
  420. Deliver()
  421. turtle.turnLeft()
  422. turtle.forward()
  423. turtle.forward()
  424. turtle.turnRight()
  425. turtle.forward()
  426. turtle.turnLeft()
  427. SBDigTwo()
  428. turtle.forward()
  429. turtle.forward()
  430. turtle.turnLeft()
  431. turtle.foward()
  432. Deliver()
  433. turtle.turnLeft()
  434. turtle.forward()
  435. turtle.forward()
  436. turtle.turnRight()
  437. turtle.forward()
  438. turtle.turnLeft()
  439. SBDigThree()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement