Kaerius

traktor

Nov 12th, 2012
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. refuel=function()    
  2.     if turtle.getFuelLevel() ~= "unlimited" then
  3.         for n=1,16 do
  4.             nCount = turtle.getItemCount(n)
  5.             if nCount > 0 then
  6.                 turtle.select( n )
  7.                 if nCount >= nLimit then
  8.                     if turtle.refuel( nLimit ) then
  9.                         break
  10.                     end
  11.                 else
  12.                     if turtle.refuel( nCount ) then
  13.                         nLimit = nLimit - nCount
  14.                     end
  15.                 end
  16.             end
  17.         end
  18.     end    
  19. end
  20. local pArgs = { ... }
  21. local dlina = tonumber( pArgs[1] )
  22. local shirina = tonumber( pArgs[2] )
  23. local conUD = pArgs[3]
  24. local ConTurn = pArgs[4]
  25. if pArgs[1]==null then
  26.     print("Dlina(vperod)(1>): ")
  27.     dlina = tonumber(read())
  28.     print("Shirina (1>): ")
  29.     shirina = tonumber(read())
  30.     print("Up/Down mod (u/d): ")
  31.     conUD= read()
  32.     print("Left or Right? (l/r): ")
  33.     ConTurn = read()
  34. end
  35. if dlina == null then
  36.     dlina = 3
  37. end
  38. if shirina==null then
  39.     shirina=3
  40. end
  41. if conUD~=u then
  42.     if conUD~=d then
  43.         conUD=u
  44.     end
  45. end
  46. if ConTurn~=l then
  47.     if ConTurn~=r then
  48.         ConTurn=l
  49.     end
  50. end
  51. while true do
  52.     for 1, shirina do
  53.         for 1,dlina do
  54.             if conUD==u then
  55.                 if turtle.detectUp() then
  56.                     turtle.digUp()
  57.                 end
  58.             end
  59.             if conUD==d then
  60.                 if turtle.detectDown() then
  61.                     turtle.digDown()
  62.                 end
  63.             end
  64.             if turtle.detect() then
  65.                 turtle.dig()
  66.             end
  67.             if turtle.getFuelLevel()==0 then
  68.                 refuel(1)
  69.             end
  70.             turtle.forward()
  71.         end
  72.         if ConTurn==l then
  73.             turtle.turnLeft()
  74.             turtle.turnLeft()
  75.         end
  76.         if ConTurn==r then
  77.             turtle.turnRight()
  78.             turtle.turnRight()
  79.         end
  80.     end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment