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