Advertisement
Guest User

robot

a guest
Dec 7th, 2013
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. bot=peripheral.wrap("front")
  2. local trol="right"
  3.  
  4. while true do
  5.  
  6. if rs.getBundledInput(trol) > 0 then
  7.  
  8.  x,y,z=bot.getLocation(0)
  9.  mobIds=bot.getMobIds(0)
  10.  
  11.  for k,mobId in pairs(mobIds) do
  12.  
  13.   while true do
  14.    
  15.    mobData=bot.getMobData(0,mobId)
  16.    
  17.    if mobData==nil then break end
  18.    
  19.    if mobData.type=="entity.OpenPeripheral.RobotWarrior.name" then break end
  20.    
  21.    if mobData.isDead or mobData.health <0 then break end
  22.    
  23.    print("Aiming at: "..mobData.type)--reports target type to help identify enties that might need filtered out
  24.  
  25.   bot.aimAt(0,mobData.position.x+x,mobData.position.y+y,mobData.position.z+z)
  26.   bot.fireLight(0)
  27.   sleep(0.3)
  28.  
  29.   end
  30.  end
  31.  
  32.  bot.goto(0,x+math.random(-10,10)*50,y+math.random(-10,10),z)
  33.  os.pullEvent()
  34.  
  35. end
  36. sleep(1)
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement