Advertisement
kssr3951

bmPrepare

May 9th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.42 KB | None | 0 0
  1. -- ========================
  2. -- == bmPrepare
  3. -- ========================
  4. dofile("turtleMoveApi")
  5. local function makeUsageFunc(message)
  6.     return function()
  7.         print(message)
  8.         print("Hit enter key when ready.")
  9.         read()
  10.     end
  11. end
  12. local function makeSelectFunc(detailName, detailDamage)
  13.   return function()
  14.         for i = 1, 16 do
  15.             dat = turtle.getItemDetail(i)
  16.             if nil ~= dat then
  17.                 if nil == detailDamage then
  18.                     if dat.name == detailName then
  19.                         turtle.select(i)
  20.                         return
  21.                     end
  22.                 else
  23.                     if dat.name == detailName and dat.damage == detailDamage then
  24.                         turtle.select(i)
  25.                         return
  26.                     end
  27.                 end
  28.             end
  29.         end
  30.   end
  31. end
  32. function dropOnly1()
  33.     turtle.drop(1)
  34. end
  35. selectCobblestone = makeSelectFunc("minecraft:cobblestone")
  36. selectTurtle = makeSelectFunc("ComputerCraft:CC-Turtle")
  37. selectChest = makeSelectFunc("minecraft:chest")
  38. registFunction("selectTurtle", selectTurtle)
  39. registFunction("selectChest", selectChest)
  40. registFunction("selectCobblestone", selectCobblestone)
  41. registFunction("dropOnly1", dropOnly1)
  42. registScript(
  43.   makeAndRegistFunc("phase1usage", makeUsageFunc(
  44. [[<phase1>
  45. chest         x 32
  46. mining turtle x  4
  47. cobblestone   x 58]])),
  48.     rep(4,
  49.         rep(7, e2, selectCobblestone, p2, e1, f),
  50.         l, e2, selectCobblestone, p2, e1, selectTurtle, p1,
  51.         l, rep(2, e1, f), r,
  52.         rep(2, e1, selectChest, p1, e0, u), e1, rep(2, e2, d), r, e1, f, l,
  53.         rep(2, e1, selectChest, p1, e0, u), e1, rep(2, e2, d), r, rep(2, e1, f), l,
  54.         e2, selectCobblestone, p2,
  55.         rep(2, e1, selectChest, p1, e0, u), e1, rep(2, e2, d), r, e1, f, l,
  56.         e2, selectCobblestone, p2,
  57.         rep(2, e1, selectChest, p1, e0, u), e1, rep(2, e2, d), r,
  58.         rep(5, e2, selectCobblestone, p2, e1, f), r
  59.   ),
  60.     makeAndRegistFunc("phase2usage", makeUsageFunc(
  61. [[<phase2>
  62. torch       x 64 x 8
  63. stone       x  4
  64. dirt        x  4
  65. gravel      x  4
  66. obsidian    x  4
  67. cobblestone x  4]])),
  68.     rep(4,
  69.         rep(7, e1, f), l,
  70.         rep(2, makeAndRegistFunc("sel_torch", makeSelectFunc("minecraft:torch")), t1),
  71.         makeAndRegistFunc("sel_Stone", makeSelectFunc("minecraft:stone")), dropOnly1,
  72.         makeAndRegistFunc("sel_dirt", makeSelectFunc("minecraft:dirt")), dropOnly1,
  73.         makeAndRegistFunc("sel_gravel", makeSelectFunc("minecraft:gravel")), dropOnly1,
  74.         makeAndRegistFunc("sel_obsidian", makeSelectFunc("minecraft:obsidian")), dropOnly1,
  75.         selectCobblestone, dropOnly1,
  76.         r, rep(7, e1, f), r
  77.     )
  78. )
  79. -- loadData()
  80. executeScript()
  81. print("completed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement