Advertisement
PHOBOSS

OriginalSwarm.lua

Mar 23rd, 2022
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2. local event = require("event")
  3. local serialization= require("serialization")
  4. local computer= require("computer")
  5. local modem = component.modem
  6. radar = component.radar
  7.  
  8. modem.open(2412)
  9. modem.broadcast(2412,"Qr= component.proxy(component.list('radar')())")
  10. modem.broadcast(2412,"Qn= component.proxy(component.list('navigation')())")
  11. modem.broadcast(2412,"Qd= component.proxy(component.list('drone')())")
  12. modem.broadcast(2412,"function sleep(timeout) checkArg(1, timeout, 'number', 'nil') local deadline = computer.uptime() + (timeout or 0) repeat computer.pullSignal(deadline - computer.uptime()) until computer.uptime() >= deadline end")
  13. modem.broadcast(2412,"e_coords={0,0,0} ")
  14.  
  15. modem.broadcast(2412,"local function getEntityCoord(e_name) for k,v in ipairs(Qr.getEntities()) do if v.name == e_name then return 1 end end return 0 end")
  16.  
  17. modem.open(2013)
  18. modem.broadcast(2013,"Sr= component.proxy(component.list('radar')())")
  19. modem.broadcast(2013,"Sn= component.proxy(component.list('navigation')())")
  20. modem.broadcast(2013,"Sd= component.proxy(component.list('drone')())")
  21. modem.broadcast(2013,"function sleep(timeout) checkArg(1, timeout, 'number', 'nil') local deadline = computer.uptime() + (timeout or 0) repeat computer.pullSignal(deadline - computer.uptime()) until computer.uptime() >= deadline end")
  22.  
  23. local function sleep(timeout) checkArg(1, timeout, "number", "nil")
  24.   local deadline = computer.uptime() + (timeout or 0)
  25.   repeat
  26.     computer.pullSignal(deadline - computer.uptime())
  27.   until computer.uptime() >= deadline
  28. end
  29.  
  30. local Qcommand = "while true do local _,_,_port,_,brk =event.pull('modem_message') if port==2412 and brk == 'stop' then Qd.setLightColor(0xFF0000) break end Qd.setLightColor(0x00FF00) end"
  31.  
  32. local command = "while true do local evt,_,_,port,_brk =computer.pullSignal() if evt=='modem_message' and port==2413 and brk =='stop' then Qd.setLightColor(0xFF0000) break end Qd.setLightColor(0x00FF00) sleep(1) end"
  33.  
  34. local c = "local cmd  local g=1 repeat cmd = select(6,computer.pullSignal(0.5)) Qd.setLightColor(0xFFFF00) Qd.setStatusText(\"Bingus \"..g) g=g+1  until cmd==\"stop\"  Qd.setLightColor(0xFF0000) Qd.setStatusText(cmd)"
  35.  
  36. local rad = "for k,v in ipairs(Qr.getEntities()) do if v.name == \"ph0\" then Qd.setLightColor(0x0000FF) Qd.setStatusText(v.name) end end"
  37.  
  38. local rad2 ="getE(\"ph0\") Qd.setStatusText(tostring(e_coords[1]))"
  39. modem.broadcast(2412,"function getE(e_name) checkArg(1,e_name,'string','nil') for k,v in ipairs(Qr.getEntities()) do if v.name == e_name then e_coords[1]=v.x e_coords[2]=v.y e_coords[3]=v.z Qd.setLightColor(0x0000FF) Qd.setStatusText(v.name) break end end end")
  40.  
  41. print("Bingus3")
  42.  
  43. e_coords = {}
  44.  
  45. function e_coords:deleteMe()
  46.   e_coords = nil
  47. end
  48.  
  49. local function getPlayerCoords(p_name)
  50.   for k,v in ipairs(require("component").radar.getEntities()) do
  51.     if v.name == p_name then
  52.       e_coords[1] = v.x
  53.       e_coords[2] = v.y
  54.       e_coords[3] = v.z
  55.       return 1
  56.     end
  57.     print(k,v.name,v.x,v.y,v.z)
  58.   end
  59.    return 0
  60. end
  61.  
  62. if getPlayerCoords("ph0")==1 then
  63.   for e in pairs(e_coords) do
  64.     print(e)
  65.   end
  66. else
  67.   print("Entity Not Found")
  68. end
  69. e_coords:deleteMe()
  70.  
  71.  
  72.  
  73. while true do
  74.   local cmd=io.read()
  75.   if not cmd then return end
  76.   modem.broadcast(2412,cmd)
  77.   if(cmd == "A") then
  78.     modem.broadcast(2412,rad2)
  79.     sleep(0.5)
  80.   elseif(cmd == "S") then
  81.     modem.broadcast(2412,"stop")
  82.     sleep(0.5)
  83.   else
  84.     modem.broadcast(2412,cmd)
  85.   end
  86. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement