Advertisement
sugar-system

turi.lua

Mar 20th, 2017
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. -- タートルが釣りするよ
  2. local function turi()
  3.   while true do -- メインループや
  4.     print('turude')
  5.     turtle.attack() -- 釣り開始やで
  6.     sleep(30) -- ちょっと待つよ
  7.     if turtle.dig() then -- 釣り上げるで
  8.       print('tureta')
  9.     else
  10.       print('turen katta')
  11.     end
  12.   end
  13. end
  14.  
  15. -- 持っとるアイテムを上のチェストに入れるよ
  16. local function simattyaoune()
  17.   while true do -- このメインループや
  18.     for i = 1, 16 do -- タートルのインベントリスロットを順番に見てくよ
  19.       print('slot '.. tostring(i) ..' wo siraberu yo')
  20.       if turtle.getItemDetail(i) then -- スロットが空かどうか調べるよ
  21.         print('simau de')
  22.         turtle.select(i)
  23.         turtle.dropUp() -- 空じゃなかったからチェストに入れるよ
  24.         turtle.select(1) -- 用が済んだら選択スロットを戻しとくんのが乙女のたしなみやで
  25.       end
  26.       sleep(1)
  27.     end
  28.   end
  29. end
  30.  
  31. -- 燃料がなかったら補給するよ
  32. local function hokyu()
  33.   while true do -- メインループや
  34.     print('nenryo kakunin ya')
  35.     if turtle.getFuelLevel() < 100 then -- 燃料がまだあるか見るよ
  36.       print('hokyu surude')
  37.       turtle.select(16) -- インベントリの最後のスロットを使うよ
  38.       turtle.suckDown() -- 燃料無いから下のチェストから出すよ
  39.       if turtle.refuel() then -- 燃料補給やで
  40.         print('hokyu sitayo (FL:'.. tostring(turtle.getFuelLevel()) ..')')
  41.       else
  42.         print('hokyu dekin katta') -- できんかった
  43.       end
  44.       turtle.select(1) -- 乙女のたしなみや
  45.     end
  46.     sleep(60) -- しばらく待機するで
  47.   end
  48. end
  49.  
  50. parallel.waitForAny(turi, simattyaoune, hokyu)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement