呼叫方式
Conditions.spatial.rcf(unit)
記錄相依項目 Conditions.spatial.rcf,然後以該名稱呼叫。含命名空間的呼叫不會傳入 self:請使用冒號呼叫,或自行傳入該物件。
作用
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.
參數
| 名稱 | 類型 | 作用 |
|---|---|---|
unit | string | Unit token, such as "target". |
傳回值
| 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. |
版本
內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。
它不會直接讀取任何遊戲 API。
範例
-- 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 <= 8相依項目
RangeCheck(builtin:Conditions/spatial.lua:RangeCheck)
原始碼
Conditions/spatial.lua,第 53 行。在遊戲中為唯讀;「複製」會產生一份可編輯的複本。
Conditions.spatial.rcf(unit)
return RangeCheck:GetRange(unit)