diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-11-15 00:23:43 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-11-15 00:30:10 +0100 |
commit | 0316f4263bf43ef45a3b5f6a543a8f1e0347fb25 (patch) | |
tree | 8b9291ed218451b4025327263a1d231eac9270e8 /server.js | |
parent | 8fc73f75669b97f4ee3f542680390db0fec6c5a0 (diff) | |
download | server-0316f4263bf43ef45a3b5f6a543a8f1e0347fb25.tar.gz |
Sending game "started - your turn" notifications.
This reverts commit 46c3fddba7038c9472a2c7b1d04d8118c275ab65.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -2136,7 +2136,7 @@ function start_game(game) { update_join_clients(game.game_id) - send_your_turn_notification_to_offline_users(game.game_id, null, state.active) + send_game_started_notification(game.game_id, state.active) } app.get("/api/replay/:game_id", function (req, res) { @@ -2462,6 +2462,17 @@ function send_chat_activity_notification(game_id, p) { send_play_notification(p, game_id, "Chat activity") } +function send_game_started_notification(game_id, active) { + let players = SQL_SELECT_PLAYERS.all(game_id) + for (let p of players) { + let p_is_active = active === p.role || active === "Both" + if (p_is_active) + send_play_notification(p, game_id, "Started - Your turn") + else + send_play_notification(p, game_id, "Started") + } +} + function send_your_turn_notification_to_offline_users(game_id, old_active, active) { // Only send notifications when the active player changes. if (old_active === active) |