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 <[email protected]>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
+3
-2
@@ -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:
|
||||
'<botname> [skill 1-5] [team]' -> ['<botname>', '[skill 1-5]', '[team]']
|
||||
"""
|
||||
import re
|
||||
# Match <arg> or [arg] patterns, including content with spaces
|
||||
pattern = r'(<[^>]+>|\[[^\]]+\])'
|
||||
args = re.findall(pattern, signature)
|
||||
|
||||
+4
-3
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user