aboutsummaryrefslogtreecommitdiff
path: root/webAO/client/createArea.ts
diff options
context:
space:
mode:
authorCaleb <caleb.mabry.15@cnu.edu>2022-09-09 18:30:07 -0400
committerCaleb <caleb.mabry.15@cnu.edu>2022-09-09 18:30:07 -0400
commite50167a8077b0ada769cdf785971972c3ad865f7 (patch)
tree711000af34cf52b508ec05ec79b2f7d6d731cd78 /webAO/client/createArea.ts
parent1e3f34e03c9dd8fda7e2b24e4533e23fcb7e1de7 (diff)
Pulled out everything I wanted
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