From 5b90d66276084825b778fa781438aa09c4428c14 Mon Sep 17 00:00:00 2001 From: Debian Date: Sun, 13 Sep 2026 14:00:13 +0200 Subject: [PATCH] Remove dead code, fix cvar argument type and add player name helper Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- lib/constants.py | 9 --------- lib/cvars.py | 5 +++-- lib/state.py | 7 ++++--- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/constants.py b/lib/constants.py index ea9847f..d219e5a 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -104,12 +104,3 @@ POWERUP_COLORS = { 'MegaHealth': '^8^4MegaHealth^7^0' } -# Curses color pairs -COLOR_PAIRS = { - 1: 1, # Red - 2: 2, # Green - 3: 3, # Yellow - 4: 4, # Blue - 5: 6, # Cyan (swapped) - 6: 5 # Magenta (swapped) -} diff --git a/lib/cvars.py b/lib/cvars.py index e00c795..3cc7249 100644 --- a/lib/cvars.py +++ b/lib/cvars.py @@ -4,6 +4,8 @@ Quake Live console variables (cvars) database Common cvars for autocomplete and fuzzy search """ +import re + # Server configuration SERVER_CVARS = [ 'sv_hostname', @@ -329,7 +331,7 @@ COMMAND_ARGUMENTS = { {'type': 'botname', 'required': True}, {'type': 'skill', 'required': False}, {'type': 'team', 'required': False}, - {'type': 'msec delay number', 'required': False}, # msec delay + {'type': 'number', 'required': False}, # msec delay {'type': 'freetext', 'required': False}, # altname ], 'removebot': [ @@ -541,7 +543,6 @@ def parse_signature(signature): Example: ' [skill 1-5] [team]' -> ['', '[skill 1-5]', '[team]'] """ - import re # Match or [arg] patterns, including content with spaces pattern = r'(<[^>]+>|\[[^\]]+\])' args = re.findall(pattern, signature) diff --git a/lib/state.py b/lib/state.py index d5ef5ef..8ff8a8c 100644 --- a/lib/state.py +++ b/lib/state.py @@ -23,7 +23,6 @@ class ServerInfo: self.roundlimit = '0' self.capturelimit = '0' self.maxclients = '0' - self.curclients = '0' self.red_score = 0 self.red_rounds = 0 self.blue_score = 0 @@ -121,6 +120,10 @@ class PlayerTracker: teams[team].append(name) return teams + def get_player_names(self): + """Get clean (color-code-stripped) names of all tracked players""" + return [strip_color_codes(name) for name in self.server_info.players] + def remove_player(self, name): """Remove player from tracking""" clean_name = strip_color_codes(name) @@ -227,5 +230,3 @@ class GameState: self.server_info = ServerInfo() self.player_tracker = PlayerTracker(self.server_info) self.event_deduplicator = EventDeduplicator() - self.pending_background_commands = set() - self.status_buffer = []