Scheballs

Railway_v0.1

Sep 23rd, 2013
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. local tArgs = { ... }
  2. local dis = tonumber(tArgs[1])
  3.  
  4. local cPath = 1
  5. local Edge = 5
  6. local uPath = 9
  7. local cPathEnChest = 4
  8. local EdgeEnChest = 8
  9. local uPathEnChest = 12
  10. --local y = 0
  11.  
  12. --Functions
  13.  
  14.  
  15. local function dumpCrap()
  16.     turtle.select(16)
  17.     turtle.place()
  18.     turtle.select(2)
  19.     turtle.drop()
  20.     turtle.select(3)
  21.     turtle.drop()
  22.     turtle.select(6)
  23.     turtle.drop()
  24.     turtle.select(7)
  25.     turtle.drop()
  26.     turtle.select(10)
  27.     turtle.drop()
  28.     turtle.select(11)
  29.     turtle.drop()
  30.     turtle.select(13)
  31.     turtle.drop()
  32.     turtle.select(14)
  33.     turtle.drop()
  34.     turtle.select(15)
  35.     turtle.drop()
  36.     turtle.select(16)
  37.     turtle.dig()
  38. end
  39.  
  40. local function getItem(slot,chestslot)
  41.     turtle.dig()
  42.     turtle.select(chestslot)
  43.     turtle.place()
  44.     turtle.select(slot)
  45.     turtle.suck()
  46.     turtle.select(chestslot)
  47.     turtle.dig()
  48. end
  49.  
  50. local function CheckslotCount(slot,chestslot)
  51.     if turtle.getItemCount(slot) < 4 then
  52.         getItem(slot,chestslot)
  53.     end
  54. end
  55.  
  56. local function tfuel(amount)
  57.  if turtle.getFuelLevel() < 5 then
  58.   turtle.select(5)
  59.   turtle.refuel(amount)
  60.  end
  61. end
  62.  
  63. local function checkHeight()
  64.   if turtle.detectDown() then
  65.     for i = 1, 10 do
  66.       turtle.up()
  67.       sleep(0.2)   
  68.     end
  69.   else
  70.     turtle.down()
  71.     sleep(0.2)
  72.     tfuel(1)
  73.     --y = y + 1
  74.     checkHeight()
  75.   end
  76. end
  77.  
  78. -- Main Script
  79.  
  80.  
  81. for i = 1, dis do
  82.  
  83.  --if i % 2 == 0 then
  84.  checkHeight()
  85.  --end
  86.  
  87.  tfuel(1)
  88.  turtle.digDown()
  89.  turtle.select(uPath)
  90.  turtle.placeDown()
  91.  turtle.turnLeft()
  92.  turtle.dig()
  93.  turtle.select(Edge)
  94.  turtle.place()
  95.  
  96.  turtle.turnRight()
  97.  turtle.turnRight()
  98.  turtle.dig()
  99.  
  100.  turtle.select(Edge)
  101.  turtle.place()
  102.  
  103.  turtle.turnLeft()
  104.  turtle.dig()
  105.  
  106.  tfuel(1)
  107.  turtle.forward()
  108.  turtle.turnRight()
  109.  turtle.turnRight()
  110.  turtle.select(cPath)
  111.  turtle.place()
  112.  
  113.  turtle.turnRight()
  114.  turtle.turnRight()
  115.  
  116.  if i % 4 == 0 then
  117.     dumpCrap()
  118.  end
  119.  
  120.  CheckslotCount(cPath,cPathEnChest)
  121.  CheckslotCount(Edge,EdgeEnChest)
  122.  CheckslotCount(uPath,uPathEnChest)
  123.  print( i .. " of " .. dis .. " meters built")
  124. end
Advertisement
Add Comment
Please, Sign In to add comment