Pre-combat-improvements: Combat animations, flee fixes, corpse logic updates

This commit is contained in:
Joan
2026-02-03 19:48:37 +01:00
parent 0b0a23f500
commit e6747b1d05
29 changed files with 827 additions and 243 deletions

View File

@@ -2,6 +2,7 @@
WebSocket connection manager for real-time game updates.
Handles WebSocket connections and Redis pub/sub for cross-worker communication.
"""
import uuid
from typing import Dict, Optional, List
from fastapi import WebSocket
import logging
@@ -86,9 +87,13 @@ class ConnectionManager:
connections = self.active_connections[player_id]
disconnected_sockets = []
# Inject unique message ID for tracing
if "id" not in message:
message["id"] = str(uuid.uuid4())
for websocket in connections:
try:
logger.debug(f"Sending {message.get('type')} to player {player_id}")
logger.debug(f"Using WS: Sending msg {message['id']} type={message.get('type')} to player {player_id}")
await websocket.send_json(message)
except Exception as e:
logger.error(f"Failed to send message to player {player_id}: {e}")