diff --git a/scripts/ai/collective.lua b/scripts/ai/collective.lua index c793d06..aae15b7 100644 --- a/scripts/ai/collective.lua +++ b/scripts/ai/collective.lua @@ -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