mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2026-06-19 07:01:10 +00:00
[>] snowman > unicycle
This commit is contained in:
+8
-8
@@ -399,7 +399,7 @@ class Client:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.debug(f"Invalid car_json: Error: {e}; Data: {car_data}")
|
self.log.debug(f"Invalid car_json: Error: {e}; Data: {car_data}")
|
||||||
allow = True
|
allow = True
|
||||||
allow_snowman = True
|
allow_unicycle = True
|
||||||
over_spawn = False
|
over_spawn = False
|
||||||
lua_data = ev.call_lua_event("onVehicleSpawn", self.cid, car_id, car_data[car_data.find("{"):])
|
lua_data = ev.call_lua_event("onVehicleSpawn", self.cid, car_id, car_data[car_data.find("{"):])
|
||||||
if 1 in lua_data:
|
if 1 in lua_data:
|
||||||
@@ -412,9 +412,9 @@ class Client:
|
|||||||
# TODO: handle event onCarSpawn
|
# TODO: handle event onCarSpawn
|
||||||
pass
|
pass
|
||||||
pkt = f"Os:{self.roles}:{self.nick}:{self.cid}-{car_id}:{car_data}"
|
pkt = f"Os:{self.roles}:{self.nick}:{self.cid}-{car_id}:{car_data}"
|
||||||
snowman = car_json.get("jbm") == "unicycle"
|
unicycle = car_json.get("jbm") == "unicycle"
|
||||||
if allow and config.Game['cars'] > cars_count or (snowman and allow_snowman) or over_spawn:
|
if allow and config.Game['cars'] > cars_count or (unicycle and allow_unicycle) or over_spawn:
|
||||||
if snowman:
|
if unicycle:
|
||||||
unicycle_id = self._unicycle['id']
|
unicycle_id = self._unicycle['id']
|
||||||
if unicycle_id != -1:
|
if unicycle_id != -1:
|
||||||
self.log.debug(f"Delete old unicycle: car_id={unicycle_id}")
|
self.log.debug(f"Delete old unicycle: car_id={unicycle_id}")
|
||||||
@@ -429,8 +429,8 @@ class Client:
|
|||||||
"packet": pkt,
|
"packet": pkt,
|
||||||
"json": car_json,
|
"json": car_json,
|
||||||
"json_ok": bool(car_json),
|
"json_ok": bool(car_json),
|
||||||
"snowman": snowman,
|
"unicycle": unicycle,
|
||||||
"over_spawn": (snowman and allow_snowman) or over_spawn,
|
"over_spawn": (unicycle and allow_unicycle) or over_spawn,
|
||||||
"pos": {}
|
"pos": {}
|
||||||
}
|
}
|
||||||
await self._send(pkt, to_all=True, to_self=True)
|
await self._send(pkt, to_all=True, to_self=True)
|
||||||
@@ -466,8 +466,8 @@ class Client:
|
|||||||
if cid == self.cid or admin_allow:
|
if cid == self.cid or admin_allow:
|
||||||
await self._send(raw_data, to_all=True, to_self=True)
|
await self._send(raw_data, to_all=True, to_self=True)
|
||||||
car = self._cars[car_id]
|
car = self._cars[car_id]
|
||||||
if car['snowman']:
|
if car['unicycle']:
|
||||||
self.log.debug(f"Snowman found")
|
self.log.debug("unicycle found")
|
||||||
unicycle_id = self._unicycle['id']
|
unicycle_id = self._unicycle['id']
|
||||||
self._unicycle['id'] = -1
|
self._unicycle['id'] = -1
|
||||||
self._cars[unicycle_id] = None
|
self._cars[unicycle_id] = None
|
||||||
|
|||||||
Reference in New Issue
Block a user