Added event onCarChanged;

This commit is contained in:
Maxim Khomutov 2023-07-26 01:09:28 +03:00
parent e348ffecc3
commit 13be12a7a1
2 changed files with 19 additions and 17 deletions

View File

@ -541,8 +541,8 @@ class Client:
cid, car_id = self._get_cid_vid(raw_data[5:])
if car_id != -1 and cid == self.cid and self._cars[car_id]:
data = raw_data[raw_data.find("{"):]
ev.call_event("onCar", car_id=car_id, data=data)
await ev.call_async_event("onCarFocusMove", car_id=car_id, data=data)
ev.call_event("onCarChanged", car_id=car_id, data=data)
await ev.call_async_event("onCarChanged", car_id=car_id, data=data)
await self._send(raw_data, to_all=True, to_self=False)
case "m": # Move focus car

View File

@ -22,21 +22,21 @@ class EventsSystem:
self.loop = asyncio.get_event_loop()
self.as_tasks = []
self.__events = {
"onServerStarted": [],
"onPlayerSentKey": [], # Only sync
"onPlayerAuthenticated": [], # Only sync
"onPlayerJoin": [],
"onChatReceive": [],
"onCarSpawn": [],
"onCarDelete": [],
"onCarEdited": [],
"onCarReset": [],
""
"onCarFocusMove": [],
"onSentPing": [], # Only sync
"onChangePosition": [], # Only sync
"onPlayerDisconnect": [],
"onServerStopped": [],
"onServerStarted": [], # No handler
"onPlayerSentKey": [], # Only sync, no handler
"onPlayerAuthenticated": [], # (!) Only sync, With handler
"onPlayerJoin": [], # (!) With handler
"onChatReceive": [], # (!) With handler
"onCarSpawn": [], # (!) With handler
"onCarDelete": [], # (!) With handler (admin allow)
"onCarEdited": [], # (!) With handler
"onCarReset": [], # No handler
"onCarChanged": [], # No handler
"onCarFocusMove": [], # No handler
"onSentPing": [], # Only sync, no handler
"onChangePosition": [], # Only sync, no handler
"onPlayerDisconnect": [], # No handler
"onServerStopped": [], # No handler
}
self.__async_events = {
"onServerStarted": [],
@ -46,6 +46,8 @@ class EventsSystem:
"onCarDelete": [],
"onCarEdited": [],
"onCarReset": [],
"onCarChanged": [],
"onCarFocusMove": [],
"onPlayerDisconnect": [],
"onServerStopped": []
}