Advertisement
Guest User

sazj.lua

a guest
Mar 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1.  local robot = require "robot"
  2.  local component = require "component"
  3.  local inv = component.inventory_controller
  4.  
  5. function sazjay()
  6.  robot.select(1)
  7.  if ({robot.detect()})[2] ~= "solid" then
  8.   if robot.count(1)<1 then
  9.    print("недостаточно саженцев")
  10.    upload()
  11.    elseif not robot.detect() then
  12.      print("ставлю саженец")
  13.      os.sleep(0.5)
  14.      robot.place()
  15.      print("поставил")
  16.      poct()
  17.   end
  18.  else
  19.  print("передомной блок, точно не саженец")
  20.  robot.swing()
  21.  print("что бы это ни было, ему пизда")
  22.  end
  23. end
  24.  
  25. function poct()
  26.  robot.select(2)
  27.  inv.equip()
  28.  print("одел мотыгу")
  29.   if robot.durability()>0.3 then
  30.    print("мотыга годная")
  31.    for i=1,5 do
  32.     robot.use()
  33.     print("рости трава большой и шторящей")
  34.    end
  35.     inv.equip()
  36.     print("снял мотыгу, одел пилу")
  37.     chopchop()
  38.   else
  39.    inv.equip()
  40.    print("ваша мотыга говно, снял мотыгу, одел пилу")
  41.    os.exit()
  42. end
  43. end
  44.  
  45.  
  46. function chopchop()
  47.   if robot.durability()>0.3 then
  48.    print("пила годная")
  49.    while robot.detect() do
  50.     robot.swing()
  51.     print("рубим рубим трынь траву")
  52.    end
  53.    os.sleep(20)
  54.    cbop()
  55.   else
  56.    print("ваша пила говно")
  57.    os.exit()
  58.   end
  59. end
  60.  
  61. function cbop()
  62.  for i=1,3 do
  63.  component.tractor_beam.suck()
  64.  print("все мое! руки убрал! засосу!")
  65.  end
  66.  if robot.count(15)>1 then
  67.  unload()
  68.  else
  69.  sazjay()
  70. end
  71. end
  72.  
  73. function unload()
  74.  print("надо облегчиться")
  75.   for i=3,15 do
  76.    robot.select(i)
  77.    robot.dropDown()
  78.   end
  79.  print("с пустым багажем и жизнь веселее")
  80.  sazjay()
  81. end
  82.  
  83. function upload()
  84.  print("кончились саженцы, загружаю")
  85.  os.exit()
  86.  robot.select(1)
  87.  robot.suckUp()
  88.  print("взял саженцы")
  89.  sazjay()
  90. end
  91.  
  92. while true do
  93.  sazjay()
  94.  os.sleep(0.1)
  95. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement