diff --git a/scripts/ai/tpl/scout.lua b/scripts/ai/tpl/scout.lua index 45299e3..0156971 100644 --- a/scripts/ai/tpl/scout.lua +++ b/scripts/ai/tpl/scout.lua @@ -23,11 +23,12 @@ function control() -- Nothing to do so check if we are too far from the planet. -- (If there is one). - planet = ai.rndplanet() + mem.approach = ai.rndplanet() + planet = mem.approach if planet ~= nil then if ai.dist(planet) > planet_dist then - ai.pushtask(0, "approach", planet) + ai.pushtask(0, "approach") return end end @@ -40,7 +41,7 @@ function control() -- Check if we are near enough. elseif task == "approach" then - planet = ai.target() + planet = mem.approach if ai.dist(planet) < planet_dist + ai.minbrakedist() then ai.poptask() @@ -89,7 +90,7 @@ end -- Approaches the target. function approach() - target = ai.target() + target = mem.approach ai.face(target) ai.accel() end