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:]) cid, car_id = self._get_cid_vid(raw_data[5:])
if car_id != -1 and cid == self.cid and self._cars[car_id]: if car_id != -1 and cid == self.cid and self._cars[car_id]:
data = raw_data[raw_data.find("{"):] data = raw_data[raw_data.find("{"):]
ev.call_event("onCar", car_id=car_id, data=data) ev.call_event("onCarChanged", car_id=car_id, data=data)
await ev.call_async_event("onCarFocusMove", 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) await self._send(raw_data, to_all=True, to_self=False)
case "m": # Move focus car case "m": # Move focus car

View File

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