Reference › Function reference › Conditions

Conditions.spatial.rangeMember

dependency

Call as

Conditions.spatial.rangeMember(cache, unit, distance)

Record the dependency Conditions.spatial.rangeMember, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.

What it does

Decides whether unit is within distance yards from the platform's cached range-check bounds: true when the maximum bound is at or inside distance, false when the minimum bound is beyond it (or equals a nonzero distance), otherwise unavailable.

Arguments

NameTypeWhat it does
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.
unitstringUnit token to check.
distancenumberDistance in yards.

Returns

1boolean | nilWhether the unit is within distance, or nil when the bounds cannot decide.
2string | nilThe bounds reader's reason, or range-uncertain.

Editions

Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.

It reads no game API directly.

How the addon calls it

Dependencies

Source

Conditions/spatial.lua, line 656. Read only in game; Duplicate makes an editable copy.

Conditions.spatial.rangeMember(cache, unit, distance)
    local bounds,why=Functions.cache.getCached(cache,addon.Platform.GetRangeCheckBounds,addon.Platform,unit)
    if not bounds then return nil,why end
    if bounds.maximum and bounds.maximum<=distance then return true end
    if bounds.minimum and (bounds.minimum>distance or bounds.minimum>0 and bounds.minimum==distance) then return false end
    return nil,"range-uncertain"

Back to Function reference