Include self in transfer targets and exclude item owner

This commit is contained in:
Jage9
2026-02-28 20:13:39 -05:00
parent c1cf100898
commit 83b7e1f9ce
7 changed files with 39 additions and 18 deletions

View File

@@ -209,6 +209,7 @@ ClientPacket = (
class RemoteUser(BaseModel):
id: str
userId: str | None = None
nickname: str
x: int
y: int

View File

@@ -1389,14 +1389,14 @@ class SignalingServer:
"""Send initial world snapshot to a newly connected client."""
users = [
RemoteUser(id=other.id, nickname=other.nickname, x=other.x, y=other.y)
RemoteUser(id=other.id, userId=other.user_id, nickname=other.nickname, x=other.x, y=other.y)
for ws, other in self.clients.items()
if ws is not client.websocket
]
packet = WelcomePacket(
type="welcome",
id=client.id,
player=RemoteUser(id=client.id, nickname=client.nickname, x=client.x, y=client.y),
player=RemoteUser(id=client.id, userId=client.user_id, nickname=client.nickname, x=client.x, y=client.y),
users=users,
items=[self._outbound_item(item).model_dump(exclude_none=True) for item in self.items.values()],
worldConfig={