Add calling lua events

This commit is contained in:
Maxim Khomutov 2023-07-22 02:48:42 +03:00
parent 905c0a361d
commit c068629c83
2 changed files with 3 additions and 0 deletions

View File

@ -599,9 +599,11 @@ class Client:
await self._send(data, to_all=True, to_self=False)
async def _looper(self):
ev.call_lua_event("onPlayerConnecting", self.cid)
self._connect_time = time.monotonic()
await self._send(f"P{self.cid}") # Send clientID
await self._sync_resources()
ev.call_lua_event("onPlayerJoining", self.cid)
tasks = self.__tasks
recv = asyncio.create_task(self._recv())
tasks.append(recv)

View File

@ -74,6 +74,7 @@ class TCPServer:
return False, client
ev.call_event("onPlayerAuthenticated", player=client)
ev.call_lua_event("onPlayerAuth", client.nick, client.roles, client.guest, client.identifiers)
if len(self.Core.clients_by_id) > config.Game["players"]:
# TODO: i18n