SHARE
TWEET

boss.lua

a guest Mar 25th, 2019 56 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 radar = component.radar
  6. local modem = component.modem
  7.  
  8. modem.open(2412)
  9. modem.broadcast(2412,"n= component.proxy(component.list('navigation')())")
  10. modem.broadcast(2412,"d= component.proxy(component.list('drone')())")
  11. modem.broadcast(2412,"rbt= component.proxy(component.list(‘robot’)())")
  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.  
  14. local 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
  15. end
  16.  
  17. while true do
  18. local cmd=io.read()
  19.  if not cmd then return
  20.  end
  21.  
  22.  if cmd=="SWARM1" then
  23.    print("Target: ") tag=io.read()
  24.    print("Drone No.: ") srm=io.read()
  25.      repeat
  26.       local cmd=select(1,event.pull(1))
  27.  
  28.   for k, v in ipairs(radar.getEntities()) do
  29.     if v.name==tag then
  30.         x= v.x  y=v.y  z=v.z
  31.     end
  32.     if v.y>0 then y=v.y+1
  33.     end
  34.   end  
  35.   modem.broadcast(2412,"for k, v in ipairs (n.findWaypoints(100)) do if v.label=='yeet' and d.name()=='"..srm.."' then a=-v.position[1]-'"..x.."'+ math.random(-3,3) math.abs(a) if ( -v.position[1]>"..x..") then a=-a elseif(-v.position[1]<="..x..")then a=math.abs(a)  end b=-v.position[2]-'"..y.."'+ math.random(-3,3) math.abs(b) if ( -v.position[2]>"..y..") then b=-b elseif(-v.position[2]<="..y..")then b=math.abs(b)  end c=-v.position[3]-'"..z.."'+ math.random(-3,3) math.abs(c) if ( -v.position[3]>"..z..") then c=-c elseif(-v.position[3]<="..z..")then c=math.abs(c)  end  d.move(a,b,c) end end")
  36.  
  37. print (x,y,z)sleep(0.0001)
  38.  
  39.     until cmd=="key_down"
  40.   end
  41.  
  42.   print(select(6, event.pull(3, "modem_message")))
  43.  
  44. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top