Справочник › Справочник функций › Conditions

Conditions.spatial.rangeMember

зависимость

Как вызывать

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

Запишите зависимость Conditions.spatial.rangeMember и вызывайте её по этому имени. Вызов через пространство имён не передаёт self: используйте вызов через двоеточие или передайте объект сами.

Что делает

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.

Аргументы

ИмяТипЧто делает
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.
unitstringUnit token to check.
distancenumberDistance in yards.

Возвращает

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

Издания

Встроенные помощники регистрируются во всех изданиях. Различается игровой API, который они читают; если нужного API нет, помощник использует запасной вариант или возвращает nil с причиной.

Не читает игровой API напрямую.

Как его вызывает аддон

Зависимости

Исходный код

Conditions/spatial.lua, строка 656. В игре только для чтения; «Дублировать» создаёт редактируемую копию.

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"

Назад: Справочник функций