Merge branch 'master' of git://github.com/BTAxis/naev into testmission
[naev.git] / docs / ai / examples / hyperspace.lua
blobe0e0e4de71cb597ef5d44efc7e796bd9061d3ea5
1 --[[
2 -- we check to see if we can hyperspace in control to not spam
3 --]]
5 -- add this to control function
6 function control ()
7 task = ai.taskname()
8 if task == "hyperspace" then
9 ai.hyperspace() -- try to hyperspace
10 end
11 end
14 -- goes hyperspace
15 function hyperspace ()
16 dir = ai.face(-1) -- face away from (0,0)
17 if (dir < 10) then -- try to go straight
18 ai.accel()
19 end
20 end