diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-27 08:02:11 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-27 08:02:11 +0000 |
commit | 18bb386d69a86df0d20e685fabdee873c7d10979 (patch) | |
tree | 161289606af608d6e9ea2b402bb7d0e387f428c1 /tools | |
parent | 129fca876d1efb7b238e277fc82c6589d52ac016 (diff) | |
parent | b8a0e71403e00cdce59f86c576cdfc68a76b7f10 (diff) | |
download | 1989-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.js | 1 | ||||
-rw-r--r-- | tools/genconst.js | 25 |
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("") |