Skip to content

Commit b386749

Browse files
committed
feat: 完善玩家与 NPC 判断接口
1 parent 7283d22 commit b386749

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Boilerplate_!Base/src/lib/BaseAPI.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,14 @@ end
155155
---@param dwID number @ID
156156
---@return boolean @是否为玩家
157157
function X.IsPlayer(dwID)
158-
return IsPlayer(dwID)
158+
return dwID ~= 0 and IsPlayer(dwID)
159+
end
160+
161+
-- 获取 ID 是否为 NPC(区别于玩家)
162+
---@param dwID number @ID
163+
---@return boolean @是否为 NPC
164+
function X.IsNpc(dwID)
165+
return dwID ~= 0 and not IsPlayer(dwID)
159166
end
160167

161168
-- 获取主角玩家对象

0 commit comments

Comments
 (0)