crocrodail

Untitled

Jan 21st, 2021
1,093
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local time = 205
  2. local chestSide = 'Right'
  3.  
  4. function checkPosition()
  5.   local success, block = turtle.inspect()
  6.   if success then
  7.     if block.name == "projecte:collector_mk3" then
  8.       print("mk3 front")
  9.       function waiting(i)
  10.         if i ~= time or i < time then
  11.           i = i + 1
  12.           print("waiting "..i.."/"..time)
  13.           sleep(1)
  14.           waiting(i)
  15.         end
  16.       end
  17.       waiting(0)
  18.       turtle.dig()
  19.       local p = find(1, "projecte:collector_mk3")
  20.       if p then
  21.         turtle.select(p)
  22.         turtle.place()
  23.       end
  24.       StartProgram()
  25.     else
  26.       print("no mk3 turn")
  27.       turtle.turnRight()
  28.       checkPosition()
  29.     end
  30.   end
  31. end
  32.  
  33. function StartProgram()
  34.   while true do
  35.     print("select slot 16")
  36.     turtle.select(16)
  37.     sleep(1)
  38.     if chestSide == 'Right' then
  39.       print("tourne a droite")
  40.       turtle.turnRight()
  41.     else
  42.       print("tourne a gauche")
  43.       turtle.turnLeft()
  44.     end
  45.     print("aspire")
  46.     turtle.suck()
  47.     if chestSide == 'Right' then
  48.       print("tourne a gauche")
  49.       turtle.turnLeft()
  50.     else
  51.       print("tourne a droite")
  52.       turtle.turnRight()
  53.     end
  54.     print("sleep 1")
  55.     sleep(1)
  56.     local k = find(1, "minecraft:coal")
  57.     if k then
  58.       turtle.select(k)
  59.     end
  60.     print("drop")
  61.     turtle.drop()
  62.     function waiting(i)
  63.       if i ~= time or i < time then
  64.         i = i + 1
  65.         print("waiting "..i.."/"..time)
  66.         sleep(1)
  67.         waiting(i)
  68.       end
  69.     end
  70.     waiting(0)
  71.     turtle.dig()
  72.     local p = find(1, "projecte:collector_mk3")
  73.     if p then
  74.       turtle.select(p)
  75.       turtle.place()
  76.     end
  77.   end
  78. end
  79.  
  80. function find(i , name)
  81.   local i = i
  82.   local name = name
  83.   if i > 16 then
  84.     return false
  85.   end
  86.   turtle.select(i)
  87.   local data = turtle.getItemDetail()
  88.   if data then
  89.     if data.name == name then
  90.       return i
  91.     else
  92.       i = i + 1
  93.       return find(i, name)
  94.     end
  95.   else
  96.     i = i + 1
  97.     return find(i, name)
  98.   end
  99. end
  100. local p = find(1, "projecte:collector_mk3")
  101. if p then
  102.   print("mk3 solt "..p)
  103.   turtle.select(p)
  104.   turtle.place()
  105. else
  106.   print("mk3 not fond")
  107. end
  108. checkPosition()
  109. print("startprogram bottom")
  110. StartProgram()
  111.  
RAW Paste Data