[Change] Improved collective ai.
This commit is contained in:
parent
56d10e603b
commit
c7d85fe6e2
@ -1,17 +1,23 @@
|
||||
include("../scripts/ai/include/basic.lua")
|
||||
|
||||
-- Required control rate.
|
||||
control_rate = 2
|
||||
control_rate = 0.5
|
||||
|
||||
function control()
|
||||
if ai.taskname() == nil then
|
||||
enemy = ai.getenemy()
|
||||
local task = ai.taskname()
|
||||
|
||||
if task == "none" then
|
||||
local enemy = ai.getenemy()
|
||||
|
||||
if enemey ~= 0 then
|
||||
-- Make hostile to enemy (mainly player).
|
||||
ai.hostile(enemy)
|
||||
ai.pushtask(0, "attack", enemy)
|
||||
else
|
||||
ai.pushtask(0, "hyperspace")
|
||||
end
|
||||
elseif task == "hyperspace" then
|
||||
ai.hyperspace()
|
||||
else
|
||||
attack_closestenemy()
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user