Cut playername length

This commit is contained in:
Emily 2019-08-01 01:09:26 +02:00
parent 7df8222cb4
commit 858b95fb48

View File

@ -10,7 +10,7 @@ flights = {}
clients = set() clients = set()
STRUCTS = { STRUCTS = {
"start": b"fHB24s", "start": b"fHB%ds",
"end": b"", "end": b"",
"flight_data": b"2BHhH3f", "flight_data": b"2BHhH3f",
"server_open": b"", "server_open": b"",
@ -152,12 +152,15 @@ class Flight:
self.model_id, self.model_id,
self.playername_len, self.playername_len,
self.playername self.playername
) = struct.unpack(b"<" + STRUCTS["start"], data[:31]) ) = struct.unpack(b"<" + STRUCTS["start"] % 24, data[:31])
self.active = True self.active = True
self.last_timeline_values = [None] * 8 self.last_timeline_values = [None] * 8
self.timeline = b"" self.timeline = b""
# Fix playername padding
self.playername = self.playername[:self.playername_len]
logging.info("[%d] Flight started" % self.uuid) logging.info("[%d] Flight started" % self.uuid)
asyncio.ensure_future( broadcast_flight_change(self.uuid, self.active) ) asyncio.ensure_future( broadcast_flight_change(self.uuid, self.active) )