Skip to content

Commit af4e852

Browse files
committed
Added support for when the Client does not exist.
1 parent c1290fd commit af4e852

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/core/modules/players/players_wrap.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ void export_client(scope _players)
289289
);
290290

291291
Client.def("is_hearing_client",
292-
&IClient::IsHearingClient,
292+
&IClientExt::IsHearingClient,
293293
"Return True if client hears this player.",
294-
args("index")
294+
args("sender")
295295
);
296296

297297
Client.def("is_proximity_hearing_client",
298-
&IClient::IsProximityHearingClient,
298+
&IClientExt::IsProximityHearingClient,
299299
"Return True if client hears this player by proximity.",
300-
args("index")
300+
args("sender")
301301
);
302302

303303
// TODO: Export more

src/core/modules/players/players_wrap.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ class IClientExt
8686
return true;
8787
}
8888
#endif
89+
90+
static bool IsHearingClient(IClient* pClient, IClient* pSender)
91+
{
92+
if (!pSender)
93+
return false;
94+
95+
return pClient->IsHearingClient(pSender->GetPlayerSlot());
96+
}
97+
98+
static bool IsProximityHearingClient(IClient* pClient, IClient* pSender)
99+
{
100+
if (!pSender)
101+
return false;
102+
103+
return pClient->IsProximityHearingClient(pSender->GetPlayerSlot());
104+
}
89105
};
90106

91107

0 commit comments

Comments
 (0)