Detect team modes by GAME_TYPE code and sync gametype at match start
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
+9
-2
@@ -103,14 +103,15 @@ class EventParser:
|
||||
|
||||
def _handle_player_connect(self, data):
|
||||
"""Track a connecting player so the roster is complete; connects to the
|
||||
server land as spectators until they join a team. No feed line: the
|
||||
server land as spectators until they join a team — except reconnects of
|
||||
already-tracked players, whose known team is kept. No feed line: the
|
||||
RCON connect broadcast already displays one."""
|
||||
name = data.get('NAME')
|
||||
if not name:
|
||||
return None
|
||||
team = data.get('TEAM')
|
||||
if team is None:
|
||||
team = 'SPECTATOR'
|
||||
team = self.game_state.player_tracker.get_team(name) or 'SPECTATOR'
|
||||
self.game_state.player_tracker.update_team(name, team)
|
||||
self.game_state.player_tracker.add_player(name)
|
||||
return None
|
||||
@@ -343,6 +344,12 @@ class EventParser:
|
||||
# Get Match Time
|
||||
self._sync_match_time(data)
|
||||
|
||||
# GAME_TYPE/FACTORY_TITLE are the authoritative gametype for this match;
|
||||
# the title alone can be customized and defeat exact team-mode matching
|
||||
self.game_state.server_info.game_type_code = data.get('GAME_TYPE', '')
|
||||
if data.get('FACTORY_TITLE'):
|
||||
self.game_state.server_info.gametype = data['FACTORY_TITLE']
|
||||
|
||||
# The PLAYERS array is the authoritative roster at match start: sync
|
||||
# teams (numeric codes via TEAM_MAP) and reset scores, clear dead
|
||||
# markers, and drop stale dedup signatures (TIME restarts at 0)
|
||||
|
||||
Reference in New Issue
Block a user