Advertisement
klindley

Untitled

Jan 24th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. robot = require("component").robot
  2. sides = require("sides")
  3. ic = require("component").inventory_controller
  4. crafting = require("component").crafting
  5.  
  6. local selectedSlot = 1
  7.  
  8. local howMany = ...
  9. howMany = tonumber(howMany)
  10.  
  11. function turnAround()
  12. robot.turn(true)
  13. robot.turn(true)
  14. end
  15.  
  16. function craftItem()
  17. robot.select(1)
  18. ic.equip()
  19. crafting.craft(1)
  20. ic.equip()
  21. robot.select(selectedSlot)
  22. usesRemaining = 32
  23. end
  24.  
  25. function placeItem(dir)
  26. local success = true
  27. if robot.count(selectedSlot) == 0 then
  28. if (selectedSlot == 16) then
  29. return false, "Out of Items"
  30. end
  31. selectedSlot = selectedSlot + 1
  32. robot.select(selectedSlot)
  33. end
  34.  
  35. success = robot.place(dir)
  36.  
  37. robot.use(dir)
  38.  
  39. return success
  40. end
  41.  
  42. for i = 0, howMany, 5 do
  43. placeItem(sides.up)
  44. robot.move(sides.forward)
  45. robot.move(sides.forward)
  46. robot.move(sides.forward)
  47. robot.move(sides.forward)
  48. robot.move(sides.forward)
  49. robot.move(sides.forward)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement