Changeset e007fcd for pages/api/roulette/gameStates.js
- Timestamp:
- 07/16/22 21:31:18 (2 years ago)
- Branches:
- main
- Children:
- e903234
- Parents:
- 55701f0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pages/api/roulette/gameStates.js
r55701f0 re007fcd 26 26 game.status = '_1_ongoing_timer'; 27 27 28 let inactivePlayers = [] 29 28 30 game.players.forEach(player => { 29 31 player.whichBets = []; … … 37 39 player.status = '_1_no_placed_bet'; 38 40 player.gotResults = false; 41 42 const d = Date.now(); 43 44 if (d - player.lastActivity > 200000) { 45 inactivePlayers.push(player); 46 } 39 47 }) 48 49 for (let i = 0; i < inactivePlayers.length; i++) { 50 if (game.players.indexOf(inactivePlayers[i]) !== -1) { 51 game.players.splice(game.players.indexOf(inactivePlayers[i]), 1); 52 } 53 } 40 54 } 41 55 … … 68 82 } 69 83 70 export function addPlayer(session_id, name ) {84 export function addPlayer(session_id, name, username) { 71 85 if (game.players.map(e=>e.session_id).indexOf(session_id) === -1) { 72 86 game.players.push({ 87 lastActivity: Date.now(), 73 88 session_id: session_id, 89 username: username, 74 90 name: name, 75 91 whichBets: [],
Note:
See TracChangeset
for help on using the changeset viewer.