[Add] Created an 'idle' task to run when idle for easy to change idle behaviours.

This commit is contained in:
Allanis 2013-11-19 00:27:09 +00:00
parent 4af334e5e4
commit 76bea0092c

View File

@ -55,14 +55,7 @@ function control()
elseif task == "hyperspace" then
ai.hyperspace() -- Try to hyperspace.
else -- Get new task.
planet = ai.landplanet()
-- Planet must exist.
if planet == nil or land_planet == false then
ai.pushtask(0, "hyperspace")
else
ai.pushtask(0, "hyperspace")
ai.pushtask(0, "land", planet)
end
idle()
end
end
@ -82,6 +75,18 @@ function attacked(attacker)
end
end
-- Default task to run when idle.
function idle()
planet = ai.landplanet()
-- Planet must exist.
if planet == nil or land_planet == false then
ai.pushtask(0, "hyperspace")
else
ai.pushtask(0, "hyperspace")
ai.pushtask(0, "land", planet)
end
end
function create()
-- Empty stub.
end