Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bot=peripheral.wrap("front")
- local trol="right"
- while true do
- if rs.getBundledInput(trol) > 0 then
- x,y,z=bot.getLocation(0)
- mobIds=bot.getMobIds(0)
- for k,mobId in pairs(mobIds) do
- while true do
- mobData=bot.getMobData(0,mobId)
- if mobData==nil then break end
- if mobData.type=="entity.OpenPeripheral.RobotWarrior.name" then break end
- if mobData.isDead or mobData.health <0 then break end
- print("Aiming at: "..mobData.type)--reports target type to help identify enties that might need filtered out
- bot.aimAt(0,mobData.position.x+x,mobData.position.y+y,mobData.position.z+z)
- bot.fireLight(0)
- sleep(0.3)
- end
- end
- bot.goto(0,x+math.random(-10,10)*50,y+math.random(-10,10),z)
- os.pullEvent()
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement