Skip to content

Add features to support finding nearest spawn by Nav distance #123

@Cezero

Description

@Cezero

Often macros use MQ2Nav to determine the closest spawn in a pull / hunt routine and use Nav distance as a factor, resulting in many calls to Navigation.PathLength to calculate distances to a bunch of mobs within a ${NearestSpawn[]} search. These macros could be drastically simplified if MQ2Nav had features to facilitate this. Additionally, I assume there could be some optimizations that could be done if MQ2Nav was aware that it was calculating a batch of navigation paths at once (less memory fragmentation leading to OOM crashes?).

This could be exposed via a new TLO: ${NearestNavSpawn[]} that has the same API as the built-in TLO ${NearestSpawn[]} but instead of using Distance3D internally, uses the nav PathLength.

Other options might be to provide a function SortByNavDistance() that accepts a list of Spawn IDs and returns that list sorted by Navigation distance. This would be useful for macros that want to apply additional criteria to selecting which spawn to path to. Another helper function would be GetClosest() which also takes a list of Spawn IDs but returns a single Spawn ID, of the closest spawn by nav distance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions