Function MeleeEnumFindNearestMine
- Line
- 8526
- Location
- blizzard.j
- Constant?
- no
- Type
- function
- Arguments
- nothing
- Returns
- nothing
| 8526 | function MeleeEnumFindNearestMine takes nothing returns nothing |
| 8527 | local unit enumUnit = GetEnumUnit() |
| 8528 | local real dist |
| 8529 | local location unitLoc |
| 8530 | |
| 8531 | if (GetUnitTypeId(enumUnit) == 'ngol') then |
| 8532 | set unitLoc = GetUnitLoc(enumUnit) |
| 8533 | set dist = DistanceBetweenPoints(unitLoc, bj_meleeNearestMineToLoc) |
| 8534 | call RemoveLocation(unitLoc) |
| 8535 | |
| 8536 | // If this is our first mine, or the closest thusfar, use it instead.
|
| 8537 | if (bj_meleeNearestMineDist < 0) or (dist < bj_meleeNearestMineDist) then |
| 8538 | set bj_meleeNearestMine = enumUnit |
| 8539 | set bj_meleeNearestMineDist = dist |
| 8540 | endif
|
| 8541 | endif
|
| 8542 | endfunction
|