aboutsummaryrefslogtreecommitdiff
path: root/webAO/client/createArea.ts
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2022-10-12 18:25:14 +0200
committerstonedDiscord <Tukz@gmx.de>2022-10-12 18:25:14 +0200
commit8a7942c0565298c29edbf0b271d5d7c7f9e56fd8 (patch)
tree67b788f40b7a4713904836de05f0e5876c32bd79 /webAO/client/createArea.ts
parenta83c8962b68f2cc0a0e22d988b8ff030057454e5 (diff)
parent82983e0c38383ec2602b4f41327342d1c8d0a8fd (diff)
Merge branch 'master' into 2fa
Diffstat (limited to 'webAO/client/createArea.ts')
-rw-r--r--webAO/client/createArea.ts30
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