[Fix] Scout ai should probably work again.
This commit is contained in:
parent
2823f4df89
commit
5fe7753214
@ -23,11 +23,12 @@ function control()
|
|||||||
|
|
||||||
-- Nothing to do so check if we are too far from the planet.
|
-- Nothing to do so check if we are too far from the planet.
|
||||||
-- (If there is one).
|
-- (If there is one).
|
||||||
planet = ai.rndplanet()
|
mem.approach = ai.rndplanet()
|
||||||
|
planet = mem.approach
|
||||||
|
|
||||||
if planet ~= nil then
|
if planet ~= nil then
|
||||||
if ai.dist(planet) > planet_dist then
|
if ai.dist(planet) > planet_dist then
|
||||||
ai.pushtask(0, "approach", planet)
|
ai.pushtask(0, "approach")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -40,7 +41,7 @@ function control()
|
|||||||
|
|
||||||
-- Check if we are near enough.
|
-- Check if we are near enough.
|
||||||
elseif task == "approach" then
|
elseif task == "approach" then
|
||||||
planet = ai.target()
|
planet = mem.approach
|
||||||
|
|
||||||
if ai.dist(planet) < planet_dist + ai.minbrakedist() then
|
if ai.dist(planet) < planet_dist + ai.minbrakedist() then
|
||||||
ai.poptask()
|
ai.poptask()
|
||||||
@ -89,7 +90,7 @@ end
|
|||||||
|
|
||||||
-- Approaches the target.
|
-- Approaches the target.
|
||||||
function approach()
|
function approach()
|
||||||
target = ai.target()
|
target = mem.approach
|
||||||
ai.face(target)
|
ai.face(target)
|
||||||
ai.accel()
|
ai.accel()
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user