调用方式
Core.creature_conditions.configuredID(key)
记录依赖项 Core.creature_conditions.configuredID,然后按该名称调用。带命名空间的调用不会传入 self:请使用冒号调用,或自行传入该对象。
作用
Maps a stored CREATURE condition key to its numeric creature type, from BEAST (1) to GAS_CLUUD (13). GAS_CLUUD is the stored key's existing spelling, kept on purpose; any other key returns nil.
参数
| 名称 | 类型 | 作用 |
|---|---|---|
key | string | Stored creature type key, such as "UNDEAD". |
返回值
| 1 | number | nil | Creature type number, or nil for an unknown key. |
|---|
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
它不直接读取任何游戏 API。
插件如何调用它
Core.creature_conditions.GetConditionCreatureTypeMatchlocal expected=configuredID(key)
源码
Core/creature_conditions.lua,第 17 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Core.creature_conditions.configuredID(key)
if key=='BEAST' then return 1
elseif key=='DRAGONKIN' then return 2
elseif key=='DEMON' then return 3
elseif key=='ELEMENTAL' then return 4
elseif key=='GIANT' then return 5
elseif key=='UNDEAD' then return 6
elseif key=='HUMANOID' then return 7
elseif key=='CRITTER' then return 8
elseif key=='MECHANICAL' then return 9
elseif key=='OTHER' then return 10
elseif key=='TOTEM' then return 11
elseif key=='NONCOMBAT_PET' then return 12
elseif key=='GAS_CLUUD' then return 13 end