Advertisement
djPtica

fence (Ender Quarry)

May 1st, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. function line(x)
  2.  for i=1,x do
  3.   while turtle.detect() do
  4.    turtle.dig()
  5.   end
  6.   turtle.forward()
  7.   turtle.digDown()
  8.   if turtle.getItemCount(13)>0 then
  9.    turtle.select(13)
  10.   elseif turtle.getItemCount(14)>0 then
  11.    turtle.select(14)
  12.   elseif turtle.getItemCount(15)>0 then
  13.    turtle.select(15)
  14.   elseif turtle.getItemCount(16)>0 then
  15.    turtle.select(16)
  16.   end
  17.   turtle.placeDown()
  18.  end
  19. end
  20.  
  21. function check(x,y)
  22.  while true do
  23.   total = 0
  24.   for i=13, 16 do
  25.    total = total + turtle.getItemCount(i)
  26.   end
  27.   if x+x+y+y>=total then
  28.    print "Ograde: OK."
  29.    break
  30.   else
  31.    print ("Nedovoljno ograda! Stavi još ", x+x+y+y-total, " ograda u slotove 13-16.")
  32.   end
  33.  end
  34. end
  35.  
  36. --GLAVNI PROGRAM
  37.  
  38. local tArgs = {...}
  39. local a = 0
  40. local b = 0
  41. a = tonumber(tArgs[1])
  42. b = tonumber(tArgs[2])
  43.  
  44. check(a,b)
  45. turtle.up()
  46. line(a)
  47. turtle.turnRight()
  48. line(b)
  49. turtle.turnRight()
  50. line(a)
  51. turtle.turnRight()
  52. line(b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement