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