mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-09 17:27:27 +08:00
Code refactoring
- Code refactoring - Fix a bug that the other player will not become the host of the room at once, when the player disconnect in link play. > Maybe add many unknown bugs. XD > The song database `arcsong.db` will not used in the future. You can use a tool in `tool` folder to import old data.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
from operator import irshift
|
||||
from .udp_sender import CommandSender
|
||||
from .udp_class import bi, Room
|
||||
from .udp_config import Config
|
||||
import time
|
||||
|
||||
from .udp_class import Room, bi
|
||||
from .udp_config import Config
|
||||
from .udp_sender import CommandSender
|
||||
|
||||
|
||||
class CommandParser:
|
||||
def __init__(self, room: Room, player_index: int = 0) -> None:
|
||||
@@ -169,13 +169,14 @@ class CommandParser:
|
||||
re.append(x.command_0c())
|
||||
player.last_timestamp = x.timestamp
|
||||
|
||||
flag_13 = False
|
||||
# 离线判断
|
||||
for i in range(4):
|
||||
if i != self.player_index:
|
||||
t = self.room.players[i]
|
||||
if t.player_id != 0:
|
||||
if t.last_timestamp != 0:
|
||||
if t.online == 1 and x.timestamp - t.last_timestamp >= 5000000:
|
||||
if t.online == 1 and x.timestamp - t.last_timestamp >= 3000000:
|
||||
t.online = 0
|
||||
self.room.command_queue_length += 1
|
||||
self.room.command_queue.append(x.command_12(i))
|
||||
@@ -183,10 +184,10 @@ class CommandParser:
|
||||
self.room.delete_player(i)
|
||||
self.room.command_queue_length += 1
|
||||
self.room.command_queue.append(x.command_12(i))
|
||||
flag_13 = True
|
||||
|
||||
flag_11 = False
|
||||
flag_12 = False
|
||||
flag_13 = False
|
||||
|
||||
if player.online == 0:
|
||||
flag_12 = True
|
||||
|
||||
Reference in New Issue
Block a user