mirror of https://github.com/bra1n/townsquare.git
fix small issue with latency calculation
This commit is contained in:
parent
27c240e19c
commit
b047fafda1
|
@ -415,16 +415,14 @@ class LiveSession {
|
||||||
// store new player data
|
// store new player data
|
||||||
if (playerId) {
|
if (playerId) {
|
||||||
this._players[playerId] = now;
|
this._players[playerId] = now;
|
||||||
if (!this._isSpectator && !isSpectator) {
|
const ping = parseInt(latency, 10);
|
||||||
alert("Another storyteller joined the session!");
|
if (ping && ping > 0 && ping < 30 * 1000) {
|
||||||
} else if (this._isSpectator && !isSpectator) {
|
if (this._isSpectator && !isSpectator) {
|
||||||
// ping to ST
|
// ping to ST
|
||||||
if (parseInt(latency, 10)) {
|
this._store.commit("session/setPing", ping);
|
||||||
this._store.commit("session/setPing", parseInt(latency, 10));
|
} else if (!this._isSpectator) {
|
||||||
}
|
|
||||||
} else if(parseInt(latency, 10)) {
|
|
||||||
// ping to Players
|
// ping to Players
|
||||||
this._pings[playerId] = parseInt(latency, 10);
|
this._pings[playerId] = ping;
|
||||||
const pings = Object.values(this._pings);
|
const pings = Object.values(this._pings);
|
||||||
this._store.commit(
|
this._store.commit(
|
||||||
"session/setPing",
|
"session/setPing",
|
||||||
|
@ -432,6 +430,7 @@ class LiveSession {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this._store.commit(
|
this._store.commit(
|
||||||
"session/setPlayerCount",
|
"session/setPlayerCount",
|
||||||
Object.keys(this._players).length
|
Object.keys(this._players).length
|
||||||
|
|
Loading…
Reference in New Issue