[Add] Created an 'idle' task to run when idle for easy to change idle behaviours.
This commit is contained in:
parent
4af334e5e4
commit
76bea0092c
@ -55,14 +55,7 @@ function control()
|
|||||||
elseif task == "hyperspace" then
|
elseif task == "hyperspace" then
|
||||||
ai.hyperspace() -- Try to hyperspace.
|
ai.hyperspace() -- Try to hyperspace.
|
||||||
else -- Get new task.
|
else -- Get new task.
|
||||||
planet = ai.landplanet()
|
idle()
|
||||||
-- 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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -82,6 +75,18 @@ function attacked(attacker)
|
|||||||
end
|
end
|
||||||
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()
|
function create()
|
||||||
-- Empty stub.
|
-- Empty stub.
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user