StreamerYT

OC : Robot Remote (Robot/Drone)

Aug 26th, 2020 (edited)
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. function Set(z);local x={};for _, l in ipairs(z) do;x[l]=true;end;return x;end;
  2.  
  3. --===== SETTINGS =====
  4. local access = Set { "4e3e2bb0", "UUID_MODEM"}
  5. local robot_ = true
  6. --=====   END    =====
  7.  
  8.  
  9. --===== CONFIGURE =====
  10. local movetarget = nil
  11. local component_ = nil
  12. local computer_ = nil
  13.  
  14. if robot_ == true then
  15. component_ = require("component")
  16. computer_ = require("computer")
  17. else
  18. component_ = component
  19. computer_ = computer
  20. end
  21.  
  22. component = component_
  23. computer = computer_
  24. --=====    END    =====
  25.  
  26.  
  27. local modem = component.proxy(component.list('modem')())
  28. local port=467
  29. modem.open(port)
  30.  
  31. function split(z,x);if x==nil then;x="%s";end;local t={};for v in string.gmatch(z,"([^"..x.."]+)") do;table.insert(t,v);end;return t;end;
  32.  
  33. while true do
  34. local event, _, a, b, c, d = computer.pullSignal()
  35. if event == "modem_message" then
  36. if access[split(a,"-")[1]] then
  37.  
  38. pcall(load(d))
  39.  
  40. end
  41. elseif event == "motion" and movetarget == d and component.list('drone')() and component.proxy(component.list('drone')()).getVelocity() < 1 then
  42. component.proxy(component.list('drone')()).move(a,b+3,c)
  43. end
  44. end
Add Comment
Please, Sign In to add comment