diff options
| author | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-07 17:01:25 -0400 |
|---|---|---|
| committer | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-07 17:01:25 -0400 |
| commit | 3f8d0974b327e663328bc36cd97f1ba1855a2269 (patch) | |
| tree | fe9a18c8c0cdbf1ab8ef037af6f98a53b0ea018f /webAO/dom/changeBackgroundOOC.ts | |
| parent | 5362069a05b4bfbef03f37605af979aa3cf0e066 (diff) | |
Added more functions
Diffstat (limited to 'webAO/dom/changeBackgroundOOC.ts')
| -rw-r--r-- | webAO/dom/changeBackgroundOOC.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/webAO/dom/changeBackgroundOOC.ts b/webAO/dom/changeBackgroundOOC.ts new file mode 100644 index 0000000..f840729 --- /dev/null +++ b/webAO/dom/changeBackgroundOOC.ts @@ -0,0 +1,28 @@ + +import queryParser from '../utils/queryParser' +import { client } from '../client' +let { mode } = queryParser() + +/** + * Change background via OOC. + */ +export function changeBackgroundOOC() { + const selectedBG = <HTMLSelectElement>document.getElementById("bg_select"); + const changeBGCommand = "bg $1"; + const bgFilename = <HTMLInputElement>document.getElementById("bg_filename"); + + let filename = ""; + if (selectedBG.selectedIndex === 0) { + filename = bgFilename.value; + } else { + filename = selectedBG.value; + } + + + if (mode === "join") { + client.sendOOC(`/${changeBGCommand.replace("$1", filename)}`); + } else if (mode === "replay") { + client.sendSelf(`BN#${filename}#%`); + } +} +window.changeBackgroundOOC = changeBackgroundOOC;
\ No newline at end of file |
