feedback3 WE: spectator seats in the browser — 观战 in the lobby, the 观战席 strip in the room (host removes, 入座), watch-only match screen; docs (community report #26)
This commit is contained in:
1 parent
42766172d1
commit
976475efff
21 files changed
+352
-30
No files matched your search
@@ -103,6 +103,17 @@ export function selectRoute(s) {
|
||||
return 'lobby';
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the player holds one of the room's spectator seats (room.state `spectators`; community report #26, a remake
|
||||
* feature): it is no player of the room or its match, watches like an eliminated player and may not act.
|
||||
* @param {any} room room.state payload
|
||||
* @param {string|null|undefined} playerId
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isSpectating(room, playerId) {
|
||||
return playerId != null && Array.isArray(room?.spectators) && room.spectators.some((s) => s && s.playerId === playerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* The notice after a `welcome` that starts a brand-new server session (the server restarted, or this session expired
|
||||
* on it: a new playerId) while a room or a match was on screen — everything shown is gone. Null when nothing is lost
|
||||
|
||||
Reference in new issue
Block a user