Advertisement
Guest User

drone3.lua

a guest
Jun 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local drone = component.proxy(component.list("drone")())
  2. local m=component.proxy(component.list("modem")())
  3. m.open(2412)
  4.  
  5. local function sleep(timeout)
  6.     checkArg(1, timeout, "number", "nil")
  7.     local deadline = computer.uptime() + (timeout or 0)
  8.     repeat
  9.         computer.pullSignal(deadline - computer.uptime())
  10.     until computer.uptime() >= deadline
  11. end
  12.  
  13. local function receive()
  14.   while true do
  15.     drone.setLightColor(0x0000ff)
  16.     sleep(5)
  17.     drone.move(0, 23, 0)
  18.     sleep(3)
  19.     drone.move(-115, 0, 93)
  20.     sleep(15)
  21.     drone.move(0, -27, 0)
  22.     sleep(3)
  23.     drone.setLightColor(0x00ff2b)
  24.     sleep(20)
  25.     drone.move(0, 27, 0)
  26.     sleep(3)
  27.     drone.move(115, 0, -93)
  28.     sleep(15)
  29.     drone.move(0, -23, 0)
  30.     sleep(25)
  31.   end
  32. end
  33. while true do
  34.  
  35.   local result,reason=pcall(function()
  36.  
  37.     local result,reason=receive()
  38.  
  39.     if not result then return respond() end
  40.  
  41.     respond(result())
  42.  
  43.   end)
  44.  
  45.   if not result then respond() end
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement