diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-02-23 22:30:36 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-02-23 22:30:36 +0100 |
commit | 816b3bfc277dbdde0716fcd8946bb13440d67767 (patch) | |
tree | b0ed21200026ac3d57c9436dc5837af9ead13b27 /web/pw-server/src/lib/components/Visualizer.svelte | |
parent | 54b9694f0d0d7e853592317d60ad262ae8c13568 (diff) | |
download | planetwars.dev-816b3bfc277dbdde0716fcd8946bb13440d67767.tar.xz planetwars.dev-816b3bfc277dbdde0716fcd8946bb13440d67767.zip |
show bot stderr
Diffstat (limited to 'web/pw-server/src/lib/components/Visualizer.svelte')
-rw-r--r-- | web/pw-server/src/lib/components/Visualizer.svelte | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/web/pw-server/src/lib/components/Visualizer.svelte b/web/pw-server/src/lib/components/Visualizer.svelte index d53eb36..1e8d09f 100644 --- a/web/pw-server/src/lib/components/Visualizer.svelte +++ b/web/pw-server/src/lib/components/Visualizer.svelte @@ -19,10 +19,21 @@ if (matchLog === null) { visualizer.set_loading(true); } else { - visualizer.set_instance(matchLog); + console.log(matchLog); + let instanceLog = extractGameStates(matchLog); + visualizer.set_instance(instanceLog); visualizer.set_loading(false); } } + + function extractGameStates(matchLog: string): string { + // TODO: find a better way to do this + return matchLog + .split("\n") + .slice(0, -1) + .filter((line) => JSON.parse(line)["type"] == "gamestate") + .join("\n"); + } </script> <div id="main" class="loading"> |