diff options
| author | Caleb Mabry <36182383+caleb-mabry@users.noreply.github.com> | 2023-02-01 15:54:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-01 15:54:26 -0500 |
| commit | 39edb1077725a6b9db58b4c32323e847ece5f2f6 (patch) | |
| tree | 2ab4e9d3c0a007684cb3fb706f70fc677e0f7eca /webAO/client/createArea.ts | |
| parent | 0eabb5da1759439fd01e54dc986900448f483330 (diff) | |
| parent | f8ea065b5e6bccbebb918293e13cab4adb536b70 (diff) | |
Merge branch 'master' into fix-pipeline
Diffstat (limited to 'webAO/client/createArea.ts')
| -rw-r--r-- | webAO/client/createArea.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/webAO/client/createArea.ts b/webAO/client/createArea.ts new file mode 100644 index 0000000..63af644 --- /dev/null +++ b/webAO/client/createArea.ts @@ -0,0 +1,30 @@ +import { client } from "../client"; +import { area_click } from "../dom/areaClick"; + +export const createArea = (id: number, name: string) => { + const thisarea = { + name, + players: 0, + status: "IDLE", + cm: "", + locked: "FREE", + }; + + client.areas.push(thisarea); + + // Create area button + const newarea = document.createElement("SPAN"); + newarea.className = "area-button area-default"; + newarea.id = `area${id}`; + newarea.innerText = thisarea.name; + newarea.title = + `Players: ${thisarea.players}\n` + + `Status: ${thisarea.status}\n` + + `CM: ${thisarea.cm}\n` + + `Area lock: ${thisarea.locked}`; + newarea.onclick = function () { + area_click(newarea); + }; + + document.getElementById("areas")!.appendChild(newarea); +}
\ No newline at end of file |
