Skip to content

Commit 644dac7

Browse files
committed
Fix entities not getting wrapped by SF.WrapObject
Players and Entities share a metatable. This cause entities being falsely identified as players. This is a hacky way to fix this, but I do not think there is a better way to do it.
1 parent 138092b commit 644dac7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lua/starfall/sflib.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ end
247247
-- @return returns nil if the object doesn't have a known wrapper,
248248
-- or returns the wrapped object if it does have a wrapper.
249249
function SF.WrapObject( object )
250+
if type(object) == "Entity" then -- This is required because Player and Entity share a metatable
251+
return SF.Entities and SF.Entities.Wrap(object)
252+
end
253+
250254
local metatable = dgetmeta(object)
251255

252256
local wrap = object_wrappers[metatable]

0 commit comments

Comments
 (0)