mirror of
				https://github.com/bra1n/townsquare.git
				synced 2025-10-21 16:55:12 +00:00 
			
		
		
		
	2 session related fixes
This commit is contained in:
		
							parent
							
								
									91837402d4
								
							
						
					
					
						commit
						284f9054ba
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -233,6 +233,7 @@ export default {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    hostSession() {
 | 
					    hostSession() {
 | 
				
			||||||
 | 
					      if (this.session.sessionId) return;
 | 
				
			||||||
      const sessionId = prompt(
 | 
					      const sessionId = prompt(
 | 
				
			||||||
        "Enter a channel number / name for your session",
 | 
					        "Enter a channel number / name for your session",
 | 
				
			||||||
        Math.round(Math.random() * 10000)
 | 
					        Math.round(Math.random() * 10000)
 | 
				
			||||||
| 
						 | 
					@ -277,6 +278,7 @@ export default {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    joinSession() {
 | 
					    joinSession() {
 | 
				
			||||||
 | 
					      if (this.session.sessionId) return;
 | 
				
			||||||
      const sessionId = prompt(
 | 
					      const sessionId = prompt(
 | 
				
			||||||
        "Enter the channel number / name of the session you want to join"
 | 
					        "Enter the channel number / name of the session you want to join"
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -423,13 +423,14 @@ class LiveSession {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * Update a player based on incoming data.
 | 
					   * Update a player based on incoming data. Player only.
 | 
				
			||||||
   * @param index
 | 
					   * @param index
 | 
				
			||||||
   * @param property
 | 
					   * @param property
 | 
				
			||||||
   * @param value
 | 
					   * @param value
 | 
				
			||||||
   * @private
 | 
					   * @private
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  _updatePlayer({ index, property, value }) {
 | 
					  _updatePlayer({ index, property, value }) {
 | 
				
			||||||
 | 
					    if (!this._isSpectator) return;
 | 
				
			||||||
    const player = this._store.state.players.players[index];
 | 
					    const player = this._store.state.players.players[index];
 | 
				
			||||||
    if (!player) return;
 | 
					    if (!player) return;
 | 
				
			||||||
    // special case where a player stops being a traveler
 | 
					    // special case where a player stops being a traveler
 | 
				
			||||||
| 
						 | 
					@ -559,7 +560,7 @@ class LiveSession {
 | 
				
			||||||
      this._store.commit("players/update", { player, property, value });
 | 
					      this._store.commit("players/update", { player, property, value });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // update player session list as if this was a ping
 | 
					    // update player session list as if this was a ping
 | 
				
			||||||
    this._handlePing([true, value]);
 | 
					    this._handlePing([true, value, 0]);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue