summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-10-27 08:02:11 +0000
committeriainp5 <iain.pearce.ip@gmail.com>2024-10-27 08:02:11 +0000
commit18bb386d69a86df0d20e685fabdee873c7d10979 (patch)
tree161289606af608d6e9ea2b402bb7d0e387f428c1 /tools
parent129fca876d1efb7b238e277fc82c6589d52ac016 (diff)
parentb8a0e71403e00cdce59f86c576cdfc68a76b7f10 (diff)
download1989-dawn-of-freedom-18bb386d69a86df0d20e685fabdee873c7d10979.tar.gz
Merge branch 'work-in-progress' of https://github.com/iainp5/1989-Dawn-of-Freedom into work-in-progress
Tor updates for constants
Diffstat (limited to 'tools')
-rw-r--r--tools/gencode.js1
-rw-r--r--tools/genconst.js25
2 files changed, 25 insertions, 1 deletions
diff --git a/tools/gencode.js b/tools/gencode.js
index f2e3a26..a46823f 100644
--- a/tools/gencode.js
+++ b/tools/gencode.js
@@ -103,4 +103,3 @@ for (let line of fs.readFileSync("events.txt", "utf-8").split("\n")) {
emit(["return"])
console.log("]")
-console.log("// #endregion")
diff --git a/tools/genconst.js b/tools/genconst.js
new file mode 100644
index 0000000..a2b9235
--- /dev/null
+++ b/tools/genconst.js
@@ -0,0 +1,25 @@
+const data = require("../data.js")
+
+function clean_name(s) {
+ return s.toUpperCase()
+ .replace(" - ", "_")
+ .replace(/[ /-]/g, "_")
+ .replace(/[!,*"'.]/g, "")
+}
+
+console.log("")
+
+console.log("// SPACES")
+for (let s of data.spaces) {
+ console.log("const S_" + clean_name(s.ascii_name) + " = " + s.space_id)
+}
+
+console.log("")
+
+console.log("// CARDS")
+for (let c of data.cards) {
+ if (c)
+ console.log("const C_" + clean_name(c.name) + " = " + c.number)
+}
+
+console.log("")