[Change] Minor AI tweaks.
This commit is contained in:
parent
d6b0ab0e16
commit
0811f18dd7
@ -85,7 +85,9 @@ end
|
||||
--Attack target.
|
||||
function e_attack(target)
|
||||
if command then
|
||||
ai.pushtask(0, "attack", target)
|
||||
if target ~= nil then
|
||||
ai.pushtask(0, "attack", target)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -83,6 +83,11 @@ function attacked(attacker)
|
||||
if ai.target() ~= attacker then
|
||||
ai.pushtask(0, "attack", attacker)
|
||||
end
|
||||
elseif task == "runaway" then
|
||||
if ai.target() ~= attacker then
|
||||
ai.poptask()
|
||||
ai.pushtask(0, "runaway", attacker)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@ function control()
|
||||
enemy = ai.getenemy()
|
||||
|
||||
-- There is an enemy.
|
||||
if enemy ~= 0 then
|
||||
if enemy ~= nil then
|
||||
if ai.dist(enemy) < enemy_dist or ai.haslockon() then
|
||||
ai.pushtask(0, "runaway", enemy)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user