diff options
author | 0neGal <mail@0negal.com> | 2022-05-28 03:00:00 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-05-28 03:00:00 +0200 |
commit | 45bf3b862d45bd925380f9d5be68b823b6df4998 (patch) | |
tree | 062a134e0af5ea05435f69980a87ed76bc281535 /src/app/launcher.js | |
parent | a844a146e88faa0c5f7239b5d05869868f2a2aab (diff) | |
download | Viper-45bf3b862d45bd925380f9d5be68b823b6df4998.tar.gz Viper-45bf3b862d45bd925380f9d5be68b823b6df4998.zip |
fully implement server+player counts
Diffstat (limited to 'src/app/launcher.js')
-rw-r--r-- | src/app/launcher.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/app/launcher.js b/src/app/launcher.js index f426775..719048e 100644 --- a/src/app/launcher.js +++ b/src/app/launcher.js @@ -116,8 +116,15 @@ async function loadServers() { serverstatus.classList.add("checking"); try { - let servers = await (await fetch("https://northstar.tf/client/servers/")).json(); + let servers = await (await fetch("https://northstar.tf/client/servers")).json(); masterserver = true; + + playercount = 0; + servercount = servers.length; + + for (let i = 0; i < servers.length; i++) { + playercount += servers[i].playerCount + } }catch (err) { playercount = 0; servercount = 0; @@ -126,7 +133,7 @@ async function loadServers() { serverstatus.classList.remove("checking"); - if (servercount == 0) {masterserver = false} + if (servercount == 0 || ! servercount || ! playercount) {masterserver = false} if (masterserver) { serverstatus.classList.add("up"); |