Lephisto/scripts/ai/escort_player.lua

29 lines
468 B
Lua

include("../scripts/ai/tpl/generic.lua")
-- Settings
armour_run = 40
armour_return = 70
aggressive = true
function create()
-- Escorts have nothing on them.
end
-- When pilot is idle she'll escort the player.
function idle()
ai.pushtask(0, "escort", ai.getPlayer())
end
-- Escort the target.
function escort()
target = ai.targetid()
dir = ai.face(target)
dist = ai.dist(ai.pos(target))
if dir < 10 and dist > 200 then
ai.accel()
end
end