Suppress all status debris in the window instead of shape-matching chunks

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
Debian
2026-09-16 23:36:53 +02:00
co-authored by Sisyphus
parent 73e503e863
commit c08db27b57
2 changed files with 36 additions and 20 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ POLL_TIMEOUT = 100
# Timing constants # Timing constants
QUIT_CONFIRM_TIMEOUT = 3.0 # Seconds to confirm quit (Ctrl-C twice) QUIT_CONFIRM_TIMEOUT = 3.0 # Seconds to confirm quit (Ctrl-C twice)
RESPAWN_DELAY = 3.0 # Seconds before players respawn after death RESPAWN_DELAY = 3.0 # Seconds before players respawn after death
STATUS_OUTPUT_WINDOW = 3.0 # Seconds a 'status' command echo hides its chunked table output STATUS_OUTPUT_WINDOW = 1.5 # Seconds a 'status' command echo suppresses its chunked table output
STATS_CONNECTION_DELAY = 0.5 # Initial stats connection delay STATS_CONNECTION_DELAY = 0.5 # Initial stats connection delay
# UI dimensions # UI dimensions
+34 -18
View File
@@ -134,24 +134,38 @@ def is_command_output(message):
return False return False
def is_status_chunk(message): CHAT_SHAPE_PATTERN = re.compile(r'^[\w(][^:]*:\s')
def is_real_content(message):
""" """
Detect one chunk of 'status' command output. The server streams the table True for messages that are definitely not status table debris: JSON,
as many small messages (row heads, '0 16384', the steamid, the address), chat-shaped lines and game initialization. Used to end the status
so per-chunk shape checks are loose; they only apply inside the suppression window early; everything else inside the window is treated
suppression window opened by the command echo. as table debris, because the server splits rows into arbitrary chunks
(names, flag columns, '0 16384', bare steamids) that no shape check
can distinguish from real content. The status table's own 'map:' line
is chat-shaped and explicitly excluded, or it would end the window
on the first chunk.
""" """
clean = strip_color_codes(message) clean = strip_color_codes(message).strip()
stripped = clean.strip() if not clean:
if not stripped or stripped[:1] in ('{', '['):
return False return False
if 'num score ping' in clean or '--- -----' in clean: if clean[:1] in ('{', '['):
return True return True
if stripped.startswith('map:'): if clean.startswith('zmq'):
return False
if clean.startswith('map:'):
return False
if clean.startswith('broadcast:'):
clean = clean[10:].lstrip()
if clean.startswith('print "'):
clean = clean[7:]
if clean.endswith('"'):
clean = clean[:-1]
if 'Game Initialization' in clean:
return True return True
if STATUS_HEAD_PATTERN.search(clean): if CHAT_SHAPE_PATTERN.match(clean):
return True
if re.match(r'^[\d.:-]+(\s+[\w.:-]+)*\s*$', stripped):
return True return True
return False return False
@@ -519,14 +533,16 @@ def main_loop(screen, args):
logger.debug('Suppressed RCON command echo') logger.debug('Suppressed RCON command echo')
continue continue
# Hide status table chunks following a 'status' command # Suppress everything after a 'status' echo until real
# content arrives (chat, JSON, game init) or the window closes
if status_suppress_until: if status_suppress_until:
if time.time() < status_suppress_until: if time.time() >= status_suppress_until:
if is_status_chunk(message): status_suppress_until = 0.0
elif is_real_content(message):
status_suppress_until = 0.0
else:
logger.debug('Suppressed status output chunk') logger.debug('Suppressed status output chunk')
continue continue
else:
status_suppress_until = 0.0
if 'Game Initialization' in message: if 'Game Initialization' in message:
logger.info('Game initialization detected - refreshing server info') logger.info('Game initialization detected - refreshing server info')