Call as
Conditions.spatial.rcf(unit)
Record the dependency Conditions.spatial.rcf, 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
Returns the LibRangeCheck-3.0 range estimate for a unit as minimum and maximum yards. It is neither cached nor protected itself; the distance conditions call it through getCached or protectedRead.
Arguments
| Name | Type | What it does |
|---|---|---|
unit | string | Unit token, such as "target". |
Returns
| 1 | number | nil | Minimum distance in yards, or nil when no range is known. |
|---|---|---|
| 2 | number | nil | Maximum distance in yards, or nil when the unit is beyond every checked range or no range is known. |
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.
Example
-- needs the dependency Conditions.spatial.rcf
local ok, minRange, maxRange = pcall(Functions.cache.getCached, cache, Conditions.spatial.rcf, "target")
if not ok or maxRange == nil then return nil, "range-unavailable" end
return maxRange <= 8Dependencies
RangeCheck(builtin:Conditions/spatial.lua:RangeCheck)
Source
Conditions/spatial.lua, line 53. Read only in game; Duplicate makes an editable copy.
Conditions.spatial.rcf(unit)
return RangeCheck:GetRange(unit)