Advertisement
Guest User

burger.lua

a guest
Feb 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. local component = require("component")
  2. local event = require("event")
  3. local robot = component.robot
  4. local crafting = component.crafting
  5.  
  6. function getMeat(amount)
  7.    robot.select(2)
  8.    robot.suck(3, amount)
  9. end
  10.  
  11. function getToast(amount)
  12.    robot.select(5)
  13.    robot.turn(false)
  14.    robot.suck(3, amount)
  15.    robot.turn(true)
  16. end
  17.  
  18. function craftBurger(amount)
  19.    getMeat(amount)
  20.    getToast(amount)
  21.    
  22.    for i = 0, amount do
  23.       crafting.craft()
  24.       robot.select(6)
  25.       robot.drop(1)
  26.    end
  27. end
  28.  
  29. component.modem.open(8080)
  30.  
  31. while true do
  32.    _, _, sender, port, _, data = event.pull("modem_message")
  33.    if data == "stop" or data == "exit" then
  34.       os.exit()
  35.    end
  36.    
  37.    if type(data) == "number" then
  38.       craftBurger(data)
  39.    end
  40.    os.sleep(1)
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement