This commit is contained in:
2026-10-18 19:25:21 +07:00
parent c10ed2db01
commit 7b8badd140
5 changed files with 202 additions and 1 deletions
+7
View File
@@ -214,6 +214,13 @@ export function send(controller: Controller, intent: Intent) {
}
// Сравниваем с предыдущим ответом сервера, а не с локальными действиями ведущего.
export function applyRemote(controller: Controller, previous: RemoteState, next: RemoteState) {
const old = previous.music
const music = next.music
// Новая версия музыки означает отдельную серверную команду, даже при тех же значениях.
const musicChanged = !!old && !!music && music.version > old.version
controller.synchronizeRemote(() => applyRemoteState(controller, previous, next), musicChanged)
}
function applyRemoteState(controller: Controller, previous: RemoteState, next: RemoteState) {
if (next.sound !== previous.sound) send(controller, { action: 'mute', enabled: !next.sound })
if (next.version > previous.version) {
if (