Skip to content

Commit

Permalink
semperfi: Do not send trucks to build at oil derricks where they will…
Browse files Browse the repository at this point in the history
… be shot to pieces en route.
  • Loading branch information
perim committed Nov 5, 2010
1 parent ba0d8f3 commit d9be3f5
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions data/mods/multiplay/semperfi/multiplay/skirmish/ai.slo
Expand Up @@ -1167,27 +1167,24 @@ event buildDerrick(inactive)
_newDist = distBetweenTwoPoints(droid.x, droid.y, _oil.x, _oil.y);
_same = false;

if (_newDist < _bestDist and droidCanReach(droid, _oil.x, _oil.y)) // this one is closer
if (_newDist < _bestDist and droidCanReach(droid, _oil.x, _oil.y) and safeDest(me, _oil.x, _oil.y)) // this one is closer
{
if (!threatInRange(me, _oil.x, _oil.y, OIL_THREAT_RANGE, FALSE))
initIterateGroup(buildGroup); // find all units in build group.
_search = iterateGroup(buildGroup);
foundOne = false;
while (_search != NULLOBJECT && !foundOne)
{
initIterateGroup(buildGroup); // find all units in build group.
_search = iterateGroup(buildGroup);
foundOne = false;
while (_search != NULLOBJECT && !foundOne)
{
if (_search.orderx == _oil.x and _search.ordery == _oil.y and _search != droid)
{
_same = true;
foundOne = true;
}
_search = iterateGroup(buildGroup);
}
if (!_same) // do not go to same spot as another droid
if (_search.orderx == _oil.x and _search.ordery == _oil.y and _search != droid)
{
_bestDist = _newDist;
_closestOil = _oil;
_same = true;
foundOne = true;
}
_search = iterateGroup(buildGroup);
}
if (!_same) // do not go to same spot as another droid
{
_bestDist = _newDist;
_closestOil = _oil;
}
}
_oil = getFeatureB(me);
Expand Down

0 comments on commit d9be3f5

Please sign in to comment.