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:
+5
-3
@@ -5,7 +5,7 @@ Tracks server info, players, and teams
|
||||
"""
|
||||
|
||||
import logging
|
||||
from .constants import TEAM_MODES, TEAM_MAP, MAX_RECENT_EVENTS
|
||||
from .constants import TEAM_MODES, TEAM_MAP, MAX_RECENT_EVENTS, TEAM_GAME_TYPE_CODES
|
||||
from .formatter import strip_color_codes
|
||||
|
||||
logger = logging.getLogger('state')
|
||||
@@ -18,6 +18,7 @@ class ServerInfo:
|
||||
self.hostname = 'Unknown'
|
||||
self.map = 'Unknown'
|
||||
self.gametype = 'Unknown'
|
||||
self.game_type_code = ''
|
||||
self.timelimit = '0'
|
||||
self.fraglimit = '0'
|
||||
self.roundlimit = '0'
|
||||
@@ -36,8 +37,9 @@ class ServerInfo:
|
||||
self.match_time_last_sync = 0 # Timestamp of last TIME update from server
|
||||
|
||||
def is_team_mode(self):
|
||||
"""Check if current gametype is a team mode"""
|
||||
return self.gametype in TEAM_MODES
|
||||
"""Check if current gametype is a team mode, by GAME_TYPE code from
|
||||
MATCH_STARTED or by factory title"""
|
||||
return self.gametype in TEAM_MODES or self.game_type_code in TEAM_GAME_TYPE_CODES
|
||||
|
||||
def reset_round_scores(self):
|
||||
"""Reset round scores (for new matches)"""
|
||||
|
||||
Reference in New Issue
Block a user