Advertisement
MeXaN1cK

m

Apr 6th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. local r = require("robot")
  2. local com = require("component")
  3. local g = com.generator
  4. local isR = true
  5. local c = require("computer")
  6. is=com.inventory_controller
  7. dp=0
  8. r.select(1)
  9. function d()
  10.  s=2
  11.  r.select(48)
  12.  r.back()
  13.  r.placeDown()
  14.  for i2 =1, 47 do
  15.   r.select(s)
  16.   r.dropDown()
  17.   s=s+1
  18.  end
  19.  r.select(1)
  20.  r.forward()
  21. end
  22. function f()
  23.  if c.energy() < 1000 then
  24.   g.insert()
  25.  end
  26. end
  27. function check()
  28. for i=1,47 do
  29.  r.select(i) scans = is.getStackInInternalSlot()
  30.  if scans~=nil then
  31.  a = scans["label"]
  32.  if a=="Cobblestone" or a=="Dirt" or a=="Gravel" or a=="Sand" or a=="Flint" then
  33.  r.select(i) r.dropDown()
  34.  elseif a=="Coal" then
  35.  r.transferTo(1)
  36. end
  37. end
  38. end
  39. r.select(1)
  40. end
  41. while isR do
  42. io.write("Введите длину: ")
  43. a=io.read()
  44. dp = dp + 1
  45. if dp == 16 then
  46. check()
  47. dp=0
  48. end
  49. for i=1, a do
  50.  r.swingUp()
  51.  r.swing()
  52.  r.swingDown()
  53.  r.forward()
  54.  dp = dp + 1
  55.  if dp == 50 then
  56.  check()
  57.  dp=0
  58.  end
  59. end
  60. io.write("Освободить инвентарь?[Y/n]: ")
  61. b = io.read()
  62. if b == "y" then
  63.  f()
  64.  d()
  65. elseif b =="n" then
  66. end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement