Skip to content

Commit e4b8bd3

Browse files
committed
Fix isElementStreamedIn returning false for localPlayer
1 parent d446b9c commit e4b8bd3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,16 @@ int CLuaElementDefs::IsElementStreamedIn(lua_State* luaVM)
15921592
// Is this a streaming compatible class?
15931593
if (pEntity->IsStreamingCompatibleClass())
15941594
{
1595+
// Local player is always streamed in from its own perspective.
1596+
// Its entity is created via _CreateLocalModel() which doesn't go through
1597+
// InternalStreamIn(), so m_bStreamedIn can stay false even though the player
1598+
// is fully active — breaking scripts that filter handlers with isElementStreamedIn(source).
1599+
if (IS_PLAYER(pEntity) && static_cast<CClientPlayer*>(pEntity)->IsLocalPlayer())
1600+
{
1601+
lua_pushboolean(luaVM, true);
1602+
return 1;
1603+
}
1604+
15951605
CClientStreamElement* pStreamElement = static_cast<CClientStreamElement*>(pEntity);
15961606

15971607
// Return whether or not this class is streamed in

0 commit comments

Comments
 (0)