mirror of
https://github.com/AlecM33/Werewolf.git
synced 2026-02-10 04:03:33 +01:00
Fix GET_TIME_REMAINING to use accurate timer value from source instance
Co-authored-by: AlecM33 <24642328+AlecM33@users.noreply.github.com>
This commit is contained in:
@@ -372,26 +372,15 @@ const Events = [
|
||||
}
|
||||
} else {
|
||||
// Timer not on this instance, consult another container
|
||||
if (vars.timerEventSubtype === GAME_PROCESS_COMMANDS.GET_TIME_REMAINING) {
|
||||
const socket = vars.gameManager.namespace.sockets.get(vars.requestingSocketId);
|
||||
if (socket) {
|
||||
vars.gameManager.namespace.to(socket.id).emit(
|
||||
GAME_PROCESS_COMMANDS.GET_TIME_REMAINING,
|
||||
game.timerParams.timeRemaining,
|
||||
game.timerParams.paused
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await vars.eventManager.publisher?.publish(
|
||||
REDIS_CHANNELS.ACTIVE_GAME_STREAM,
|
||||
vars.eventManager.createMessageToPublish(
|
||||
game.accessCode,
|
||||
EVENT_IDS.SOURCE_TIMER_EVENT,
|
||||
vars.instanceId,
|
||||
JSON.stringify({ socketId: vars.requestingSocketId, timerEventSubtype: vars.timerEventSubtype })
|
||||
)
|
||||
);
|
||||
}
|
||||
await vars.eventManager.publisher?.publish(
|
||||
REDIS_CHANNELS.ACTIVE_GAME_STREAM,
|
||||
vars.eventManager.createMessageToPublish(
|
||||
game.accessCode,
|
||||
EVENT_IDS.SOURCE_TIMER_EVENT,
|
||||
vars.instanceId,
|
||||
JSON.stringify({ socketId: vars.requestingSocketId, timerEventSubtype: vars.timerEventSubtype })
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user