[Change] AI improvments, they should be much nicer now.

This commit is contained in:
Allanis 2014-03-07 17:49:33 +00:00
parent 64c252c8e4
commit ee259281cc

View File

@ -56,7 +56,7 @@ function atk_g()
atk_g_ranged(target, dist)
elseif dist > range * atk_aim then
if ai.relvel(target) < 0 then
if ai.relvel(target) > -10 then
atk_g_ranged(target, dist)
else
atk_g_aim(target, dist)
@ -110,6 +110,7 @@ end
function atk_g_melee(target, dist)
secondary, special = ai.secondary("melee")
dir = ai.aim(target) -- We aim instead of face.
range = ai.getweaprange()
-- Fire non-smart secondary weapons.
if(secondary == "Launcher" and special ~= "Smart") or
@ -119,6 +120,12 @@ function atk_g_melee(target, dist)
end
end
-- Drifting away we'll want to get closer.
if dir < 10 and dist > 0.5*range and ai.relvel(target) > -10 then
ai.accel()
end
-- Shoot if should be shooting.
if(dir < 10 and dist < range) or ai.hasturrets() then
ai.shoot()
end