Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- http://www.youtube.com/watch?v=Eq27GOX71TU
- bot = 1 --assign OpenMech ID
- mech = peripheral.wrap("right") --attach robot controller
- while true do
- mechX, mechY, mechZ = mech.getLocation(bot) --find OpenMech location
- mobIds = mech.getMobIds(bot) -- Find Mobs
- player = mech.getPlayerData(bot, "remorsless") --get info on the player
- if player ~= nil then
- print("Player at: "..player.position.x) --print player position
- mech.goto(bot, player.position.x + mechX, player.position.y + mechY, player.position.z + mechZ) --move to player
- sleep(.1)
- else
- print("player out of range") --if player can't be found print player out of range
- end
- if mobIds == nil then --if there are no mobs print no targets
- print("no targets")
- else
- for k, mobId in pairs(mobIds) do --get information stored in MobIds
- mob = mech.getMobData(bot, mobId) -- get data on mobs
- if mob ~= nil then
- if mob.type ~= "entity.OpenPeripheral.RobotWarrior.name" then
- print("Targeting: "..mob.type)
- mech.lookAt(bot, mob.position.x + mechX, mob.position.y + mechY, mob.position.z + mechZ) --look at mob
- mech.fireHeavy(bot)
- term.clear()
- term.setCursorPos(1,1)
- print("Heat: "..mech.getHeat(bot)) --print OpenMech heat
- print("Max: "..mech.getMaxHeat(bot))
- end
- end
- sleep(.1)
- end
- os.sleep(.1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement