diff --git a/.gitignore b/.gitignore
index 49ffcee..8e8a868 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,7 @@
/include
/build
*.tsbuildinfo
+
+# misc
+.DS_Store
+*.pem
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 42b5652..77c3375 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,7 @@
"version": "0.1.0",
"license": "ISC",
"dependencies": {
- "@aethergames/mkscribe": "^0.1.0",
+ "@aethergames/mkscribe": "^0.3.0",
"@rbxts/services": "^1.5.1",
"@rbxts/testez": "^0.4.2-ts.0"
},
@@ -28,14 +28,14 @@
}
},
"node_modules/@aethergames/mkscribe": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/@aethergames/mkscribe/-/mkscribe-0.1.0.tgz",
- "integrity": "sha512-jslOqvv/7a2XYGjihjhlCDtu7DQEvxfVbyj6Hz5jbWYJgisByFC6KxJrtpOC18ln+7DtRo7kF7m3bdovGsNH5g=="
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@aethergames/mkscribe/-/mkscribe-0.3.0.tgz",
+ "integrity": "sha512-aL18I6vXOwlKXZI8A/9syFvrRQdjsoweFw089AAtvnTYHOszPYAFUxVqwFVZgLCx4JLs+WcNnU9/aSDgGGsidA=="
},
"node_modules/@eslint/eslintrc": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz",
- "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.0.tgz",
+ "integrity": "sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
@@ -55,6 +55,15 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/@eslint/js": {
+ "version": "8.35.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.35.0.tgz",
+ "integrity": "sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==",
+ "dev": true,
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
@@ -152,9 +161,9 @@
"dev": true
},
"node_modules/@types/node": {
- "version": "16.18.12",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz",
- "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==",
+ "version": "16.18.14",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.14.tgz",
+ "integrity": "sha512-wvzClDGQXOCVNU4APPopC2KtMYukaF1MN/W3xAmslx22Z4/IF1/izDMekuyoUlwfnDHYCIZGaj7jMwnJKBTxKw==",
"dev": true
},
"node_modules/@types/semver": {
@@ -164,14 +173,14 @@
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz",
- "integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.1.tgz",
+ "integrity": "sha512-a2RQAkosH3d3ZIV08s3DcL/mcGc2M/UC528VkPULFxR9VnVPT8pBu0IyBAJJmVsCmhVfwQX1v6q+QGnmSe1bew==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "5.53.0",
- "@typescript-eslint/type-utils": "5.53.0",
- "@typescript-eslint/utils": "5.53.0",
+ "@typescript-eslint/scope-manager": "5.54.1",
+ "@typescript-eslint/type-utils": "5.54.1",
+ "@typescript-eslint/utils": "5.54.1",
"debug": "^4.3.4",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
@@ -198,12 +207,12 @@
}
},
"node_modules/@typescript-eslint/experimental-utils": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.53.0.tgz",
- "integrity": "sha512-4SklZEwRn0jqkhtW+pPZpbKFXprwGneBndRM0TGzJu/LWdb9QV2hBgFIVU9AREo02BzqFvyG/ypd+xAW5YGhXw==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.54.1.tgz",
+ "integrity": "sha512-oqSc2Gr4TL/2M0XRJ9abA1o3Wf1cFJTNqWq0kjdStIIvgMQGZ3TSaFFJ2Cvy3Fgqi9UfDZ8u5idbACssIIyHaw==",
"dev": true,
"dependencies": {
- "@typescript-eslint/utils": "5.53.0"
+ "@typescript-eslint/utils": "5.54.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -217,14 +226,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz",
- "integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.1.tgz",
+ "integrity": "sha512-8zaIXJp/nG9Ff9vQNh7TI+C3nA6q6iIsGJ4B4L6MhZ7mHnTMR4YP5vp2xydmFXIy8rpyIVbNAG44871LMt6ujg==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "5.53.0",
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/typescript-estree": "5.53.0",
+ "@typescript-eslint/scope-manager": "5.54.1",
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/typescript-estree": "5.54.1",
"debug": "^4.3.4"
},
"engines": {
@@ -244,13 +253,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz",
- "integrity": "sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz",
+ "integrity": "sha512-zWKuGliXxvuxyM71UA/EcPxaviw39dB2504LqAmFDjmkpO8qNLHcmzlh6pbHs1h/7YQ9bnsO8CCcYCSA8sykUg==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/visitor-keys": "5.53.0"
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/visitor-keys": "5.54.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -261,13 +270,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz",
- "integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.1.tgz",
+ "integrity": "sha512-WREHsTz0GqVYLIbzIZYbmUUr95DKEKIXZNH57W3s+4bVnuF1TKe2jH8ZNH8rO1CeMY3U4j4UQeqPNkHMiGem3g==",
"dev": true,
"dependencies": {
- "@typescript-eslint/typescript-estree": "5.53.0",
- "@typescript-eslint/utils": "5.53.0",
+ "@typescript-eslint/typescript-estree": "5.54.1",
+ "@typescript-eslint/utils": "5.54.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
@@ -288,9 +297,9 @@
}
},
"node_modules/@typescript-eslint/types": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz",
- "integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.1.tgz",
+ "integrity": "sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -301,13 +310,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz",
- "integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.1.tgz",
+ "integrity": "sha512-bjK5t+S6ffHnVwA0qRPTZrxKSaFYocwFIkZx5k7pvWfsB1I57pO/0M0Skatzzw1sCkjJ83AfGTL0oFIFiDX3bg==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/visitor-keys": "5.53.0",
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/visitor-keys": "5.54.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -328,16 +337,16 @@
}
},
"node_modules/@typescript-eslint/utils": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz",
- "integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.1.tgz",
+ "integrity": "sha512-IY5dyQM8XD1zfDe5X8jegX6r2EVU5o/WJnLu/znLPWCBF7KNGC+adacXnt5jEYS9JixDcoccI6CvE4RCjHMzCQ==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
- "@typescript-eslint/scope-manager": "5.53.0",
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/typescript-estree": "5.53.0",
+ "@typescript-eslint/scope-manager": "5.54.1",
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/typescript-estree": "5.54.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
@@ -354,12 +363,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz",
- "integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.1.tgz",
+ "integrity": "sha512-q8iSoHTgwCfgcRJ2l2x+xCbu8nBlRAlsQ33k24Adj8eoVBE0f8dUeI+bAa8F84Mv05UGbAx57g2zrRsYIooqQg==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.53.0",
+ "@typescript-eslint/types": "5.54.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -597,12 +606,13 @@
}
},
"node_modules/eslint": {
- "version": "8.34.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz",
- "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==",
+ "version": "8.35.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.35.0.tgz",
+ "integrity": "sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==",
"dev": true,
"dependencies": {
- "@eslint/eslintrc": "^1.4.1",
+ "@eslint/eslintrc": "^2.0.0",
+ "@eslint/js": "8.35.0",
"@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@@ -616,7 +626,7 @@
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.3.0",
"espree": "^9.4.0",
- "esquery": "^1.4.0",
+ "esquery": "^1.4.2",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
@@ -653,9 +663,9 @@
}
},
"node_modules/eslint-config-prettier": {
- "version": "8.6.0",
- "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz",
- "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==",
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.7.0.tgz",
+ "integrity": "sha512-HHVXLSlVUhMSmyW4ZzEuvjpwqamgmlfkutD53cYXLikh4pt/modINRcCIApJ84czDxM4GZInwUrromsDdTImTA==",
"dev": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
@@ -788,9 +798,9 @@
}
},
"node_modules/esquery": {
- "version": "1.4.2",
- "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz",
- "integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==",
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
+ "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
"dev": true,
"dependencies": {
"estraverse": "^5.1.0"
@@ -1764,14 +1774,14 @@
},
"dependencies": {
"@aethergames/mkscribe": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/@aethergames/mkscribe/-/mkscribe-0.1.0.tgz",
- "integrity": "sha512-jslOqvv/7a2XYGjihjhlCDtu7DQEvxfVbyj6Hz5jbWYJgisByFC6KxJrtpOC18ln+7DtRo7kF7m3bdovGsNH5g=="
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@aethergames/mkscribe/-/mkscribe-0.3.0.tgz",
+ "integrity": "sha512-aL18I6vXOwlKXZI8A/9syFvrRQdjsoweFw089AAtvnTYHOszPYAFUxVqwFVZgLCx4JLs+WcNnU9/aSDgGGsidA=="
},
"@eslint/eslintrc": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz",
- "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.0.tgz",
+ "integrity": "sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
@@ -1785,6 +1795,12 @@
"strip-json-comments": "^3.1.1"
}
},
+ "@eslint/js": {
+ "version": "8.35.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.35.0.tgz",
+ "integrity": "sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==",
+ "dev": true
+ },
"@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
@@ -1863,9 +1879,9 @@
"dev": true
},
"@types/node": {
- "version": "16.18.12",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz",
- "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==",
+ "version": "16.18.14",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.14.tgz",
+ "integrity": "sha512-wvzClDGQXOCVNU4APPopC2KtMYukaF1MN/W3xAmslx22Z4/IF1/izDMekuyoUlwfnDHYCIZGaj7jMwnJKBTxKw==",
"dev": true
},
"@types/semver": {
@@ -1875,14 +1891,14 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz",
- "integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.1.tgz",
+ "integrity": "sha512-a2RQAkosH3d3ZIV08s3DcL/mcGc2M/UC528VkPULFxR9VnVPT8pBu0IyBAJJmVsCmhVfwQX1v6q+QGnmSe1bew==",
"dev": true,
"requires": {
- "@typescript-eslint/scope-manager": "5.53.0",
- "@typescript-eslint/type-utils": "5.53.0",
- "@typescript-eslint/utils": "5.53.0",
+ "@typescript-eslint/scope-manager": "5.54.1",
+ "@typescript-eslint/type-utils": "5.54.1",
+ "@typescript-eslint/utils": "5.54.1",
"debug": "^4.3.4",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
@@ -1893,62 +1909,62 @@
}
},
"@typescript-eslint/experimental-utils": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.53.0.tgz",
- "integrity": "sha512-4SklZEwRn0jqkhtW+pPZpbKFXprwGneBndRM0TGzJu/LWdb9QV2hBgFIVU9AREo02BzqFvyG/ypd+xAW5YGhXw==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.54.1.tgz",
+ "integrity": "sha512-oqSc2Gr4TL/2M0XRJ9abA1o3Wf1cFJTNqWq0kjdStIIvgMQGZ3TSaFFJ2Cvy3Fgqi9UfDZ8u5idbACssIIyHaw==",
"dev": true,
"requires": {
- "@typescript-eslint/utils": "5.53.0"
+ "@typescript-eslint/utils": "5.54.1"
}
},
"@typescript-eslint/parser": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz",
- "integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.1.tgz",
+ "integrity": "sha512-8zaIXJp/nG9Ff9vQNh7TI+C3nA6q6iIsGJ4B4L6MhZ7mHnTMR4YP5vp2xydmFXIy8rpyIVbNAG44871LMt6ujg==",
"dev": true,
"requires": {
- "@typescript-eslint/scope-manager": "5.53.0",
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/typescript-estree": "5.53.0",
+ "@typescript-eslint/scope-manager": "5.54.1",
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/typescript-estree": "5.54.1",
"debug": "^4.3.4"
}
},
"@typescript-eslint/scope-manager": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz",
- "integrity": "sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz",
+ "integrity": "sha512-zWKuGliXxvuxyM71UA/EcPxaviw39dB2504LqAmFDjmkpO8qNLHcmzlh6pbHs1h/7YQ9bnsO8CCcYCSA8sykUg==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/visitor-keys": "5.53.0"
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/visitor-keys": "5.54.1"
}
},
"@typescript-eslint/type-utils": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz",
- "integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.1.tgz",
+ "integrity": "sha512-WREHsTz0GqVYLIbzIZYbmUUr95DKEKIXZNH57W3s+4bVnuF1TKe2jH8ZNH8rO1CeMY3U4j4UQeqPNkHMiGem3g==",
"dev": true,
"requires": {
- "@typescript-eslint/typescript-estree": "5.53.0",
- "@typescript-eslint/utils": "5.53.0",
+ "@typescript-eslint/typescript-estree": "5.54.1",
+ "@typescript-eslint/utils": "5.54.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/types": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz",
- "integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.1.tgz",
+ "integrity": "sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz",
- "integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.1.tgz",
+ "integrity": "sha512-bjK5t+S6ffHnVwA0qRPTZrxKSaFYocwFIkZx5k7pvWfsB1I57pO/0M0Skatzzw1sCkjJ83AfGTL0oFIFiDX3bg==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/visitor-keys": "5.53.0",
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/visitor-keys": "5.54.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -1957,28 +1973,28 @@
}
},
"@typescript-eslint/utils": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz",
- "integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.1.tgz",
+ "integrity": "sha512-IY5dyQM8XD1zfDe5X8jegX6r2EVU5o/WJnLu/znLPWCBF7KNGC+adacXnt5jEYS9JixDcoccI6CvE4RCjHMzCQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
- "@typescript-eslint/scope-manager": "5.53.0",
- "@typescript-eslint/types": "5.53.0",
- "@typescript-eslint/typescript-estree": "5.53.0",
+ "@typescript-eslint/scope-manager": "5.54.1",
+ "@typescript-eslint/types": "5.54.1",
+ "@typescript-eslint/typescript-estree": "5.54.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
}
},
"@typescript-eslint/visitor-keys": {
- "version": "5.53.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz",
- "integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==",
+ "version": "5.54.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.1.tgz",
+ "integrity": "sha512-q8iSoHTgwCfgcRJ2l2x+xCbu8nBlRAlsQ33k24Adj8eoVBE0f8dUeI+bAa8F84Mv05UGbAx57g2zrRsYIooqQg==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.53.0",
+ "@typescript-eslint/types": "5.54.1",
"eslint-visitor-keys": "^3.3.0"
}
},
@@ -2147,12 +2163,13 @@
"dev": true
},
"eslint": {
- "version": "8.34.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz",
- "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==",
+ "version": "8.35.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.35.0.tgz",
+ "integrity": "sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==",
"dev": true,
"requires": {
- "@eslint/eslintrc": "^1.4.1",
+ "@eslint/eslintrc": "^2.0.0",
+ "@eslint/js": "8.35.0",
"@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@@ -2166,7 +2183,7 @@
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.3.0",
"espree": "^9.4.0",
- "esquery": "^1.4.0",
+ "esquery": "^1.4.2",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
@@ -2212,9 +2229,9 @@
}
},
"eslint-config-prettier": {
- "version": "8.6.0",
- "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz",
- "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==",
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.7.0.tgz",
+ "integrity": "sha512-HHVXLSlVUhMSmyW4ZzEuvjpwqamgmlfkutD53cYXLikh4pt/modINRcCIApJ84czDxM4GZInwUrromsDdTImTA==",
"dev": true,
"requires": {}
},
@@ -2283,9 +2300,9 @@
}
},
"esquery": {
- "version": "1.4.2",
- "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz",
- "integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==",
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
+ "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
"dev": true,
"requires": {
"estraverse": "^5.1.0"
diff --git a/package.json b/package.json
index 85b1633..b6397c8 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
"test:watch": "rbxtsc -w --verbose --type game --rojo test.project.json",
"test:serve": "rojo serve ./test.project.json",
"test:rojo": "mkdir build & npm run test:build && rojo build -o ./build/test.rbxlx test.project.json",
- "test:run": "npm run prepublish && npm run test:serve",
+ "test:run": "npm run test:build && npm run test:serve",
"prepublish": "npm run build && mkdir build && npm pack --pack-destination=build",
"prepare": "husky install",
"test": "npm run test:run"
@@ -44,7 +44,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
- "@aethergames/mkscribe": "^0.1.0",
+ "@aethergames/mkscribe": "^0.3.0",
"@rbxts/services": "^1.5.1",
"@rbxts/testez": "^0.4.2-ts.0"
}
diff --git a/src/ast-interpreter/index.ts b/src/ast-interpreter/index.ts
deleted file mode 100644
index c62ecf5..0000000
--- a/src/ast-interpreter/index.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import { MkScribe } from "@aethergames/mkscribe";
-import { ScribeEnviroment } from "../types";
-import {
- DialogCallbackInput,
- PipeToCallbackInput,
- ScribeProgramProperties,
- ScribeRuntimeImplementation,
-} from "./types";
-import { TokenLiteral } from "@aethergames/mkscribe/out/mkscribe/scanner/types";
-import { ScribeVisitor, StatusInterpretationCode } from "./visitor";
-
-export class Runtime implements ScribeRuntimeImplementation {
- public dialogCallback!: (input: DialogCallbackInput) => void;
- public pipeTo!: (config: PipeToCallbackInput) => void;
-
- private interpreter!: ScribeVisitor;
-
- constructor(private readonly source: string, private readonly env: ScribeEnviroment) {}
-
- public start(): StatusInterpretationCode {
- this.interpreter = new ScribeVisitor(
- MkScribe.build(this.source),
- {
- dialog: this.dialogCallback,
- storeChange: this.pipeTo,
- },
- this.env,
- );
-
- return this.interpreter.interpret();
- }
-
- public getObjective(objective: string): TokenLiteral {
- return this.interpreter.records.objectives[objective];
- }
-
- public getProperty(property: string): TokenLiteral {
- return this.interpreter.programProperties[property];
- }
-
- public getProperties(): ScribeProgramProperties {
- return this.interpreter.programProperties;
- }
-
- public incrementStore(valueTo: string, increment: number): void {
- let head = this.interpreter.refs[valueTo];
-
- while (head !== undefined) {
- const { ref } = head;
-
- if (typeOf(this.interpreter.records.stores[ref][0]) === "number") {
- (this.interpreter.records.stores[ref][0] as number) += increment;
- } else {
- warn(`[Interpreter:incrementValue]: ${ref} isn't of type number, it can't be incremented.`);
- }
-
- head = head._next;
- }
- }
-
- public setStore(valueTo: string, value: unknown): void {
- let head = this.interpreter.refs[valueTo];
-
- while (head !== undefined) {
- this.interpreter.records.stores[head.ref][0] = value as TokenLiteral;
-
- head = head._next;
- }
- }
-
- public setCurrentObjective(objective: string): void {}
-
- public play(scene: string): void {}
-
- public interact(id: string): void {
- return this.interpreter.records.interactions[id].accept(this.interpreter);
- }
-}
diff --git a/src/index.spec.ts b/src/index.spec.ts
index fb89f3b..e36834d 100644
--- a/src/index.spec.ts
+++ b/src/index.spec.ts
@@ -1 +1,39 @@
-export = (): void => {}
\ No newline at end of file
+///
+
+import { Scribe } from "."
+
+export = (): void => {
+ describe("creating a new ScribeRuntime", () => {
+ const ScribeRuntime = Scribe.load(`
+ actor BEATRIZ "beatriz_id"
+
+ default objective hello "My objective!"
+
+ echo $test
+
+ interact BEATRIZ {
+ echo "Interacted with Beatriz!"
+ }
+
+ `, {
+ test: "Hello, world!"
+ })
+
+ it("should not throw when instantiating a new ScribeRuntime.", () => {
+ expect(() => Scribe.load("", {})).never.to.throw()
+ })
+
+ it("should not throw when retrieving an objective.", () => {
+ expect(() => {
+ ScribeRuntime.getCurrentObjective()
+ ScribeRuntime.getObjective("hello")
+ }).never.to.throw()
+ })
+
+ it("should interact correctly with the actor", () => {
+ expect(() => {
+ ScribeRuntime.interact("beatriz_id")
+ }).never.to.throw()
+ })
+ })
+}
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index 15dc78c..209d4cd 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,13 +1,8 @@
-import { Runtime } from "./ast-interpreter";
-import { ExecutionType, ModuleSource, ScribeEnviroment, StringSource, StringValueSource } from "./types";
-import { ScribeVM } from "./vm";
+import { Runtime } from "./runtime";
+import { ModuleSource, ScribeEnviroment, StringSource, StringValueSource } from "./types";
export namespace Scribe {
- export function load(
- file: string | StringValue | ModuleScript,
- env: ScribeEnviroment,
- executionType: T,
- ): T extends "ast-interpreter" ? Runtime : ScribeVM {
+ export function load(file: string | StringValue | ModuleScript, env: ScribeEnviroment): Runtime {
const toRetrieveFrom = typeOf(file);
let source!: string;
@@ -29,6 +24,6 @@ export namespace Scribe {
}
}
- return (executionType === "ast-interpreter" ? new Runtime(source, env) : new ScribeVM(source, env)) as never;
+ return new Runtime(source, env);
}
}
diff --git a/src/runtime/index.ts b/src/runtime/index.ts
new file mode 100644
index 0000000..5d0563f
--- /dev/null
+++ b/src/runtime/index.ts
@@ -0,0 +1,158 @@
+import { MkScribe } from "@aethergames/mkscribe";
+import { ScribeEnviroment } from "../types";
+import {
+ DialogCallbackInput,
+ InteractionJob,
+ Objective,
+ ObjectiveChangeCallbackInput,
+ PipeToCallbackInput,
+ ScribeProgramProperties,
+ ScribeRuntimeImplementation,
+} from "./types";
+import { TokenLiteral } from "@aethergames/mkscribe/out/mkscribe/scanner/types";
+import { ScribeVisitor, StatusInterpretationCode } from "./visitor";
+import { RunService } from "@rbxts/services";
+
+export class Runtime implements ScribeRuntimeImplementation {
+ public dialogCallback!: (input: DialogCallbackInput) => void;
+ public objectiveChangeCallback!: (input: ObjectiveChangeCallbackInput) => void;
+ public pipeTo!: (config: PipeToCallbackInput) => void;
+
+ private interpreter!: ScribeVisitor;
+
+ private interactions: Map = new Map();
+ private interactionsCooldown = 1 / 60;
+
+ constructor(private readonly source: string, private readonly env: ScribeEnviroment) {}
+
+ public start(): StatusInterpretationCode {
+ this.interpreter = new ScribeVisitor(
+ MkScribe.build(this.source),
+ {
+ onDialog: this.dialogCallback,
+ onStoreChange: this.pipeTo,
+ onObjectiveChange: this.objectiveChangeCallback,
+ },
+ this.env,
+ );
+
+ return this.interpreter.interpret();
+ }
+
+ public getObjective(objective: string): Objective | undefined {
+ return this.interpreter.records.objectives[objective];
+ }
+
+ public getCurrentObjective(): Objective | undefined {
+ const current = this.interpreter.records.objectives.current;
+
+ if (current !== undefined) {
+ return this.interpreter.records.objectives[current];
+ }
+ }
+
+ public getProperty(property: string): TokenLiteral {
+ return this.interpreter.programProperties[property];
+ }
+
+ public getProperties(): ScribeProgramProperties {
+ return this.interpreter.programProperties;
+ }
+
+ public incrementStore(valueTo: string, increment: number): void {
+ let head = this.interpreter.refs[valueTo];
+
+ while (head !== undefined) {
+ const { ref } = head;
+
+ if (typeOf(this.interpreter.records.stores[ref][0]) === "number") {
+ (this.interpreter.records.stores[ref][0] as number) += increment;
+ } else {
+ warn(`[Interpreter:incrementValue]: ${ref} isn't of type number, it can't be incremented.`);
+ }
+
+ head = head._next;
+ }
+ }
+
+ public setStore(valueTo: string, value: unknown): void {
+ let head = this.interpreter.refs[valueTo];
+
+ while (head !== undefined) {
+ this.interpreter.records.stores[head.ref][0] = value as TokenLiteral;
+
+ head = head._next;
+ }
+ }
+
+ public setCurrentObjective(objective: string): void {
+ this.interpreter.records.objectives.current = objective;
+ }
+
+ public play(id: string): void {
+ const scene = this.interpreter.records.scenes[id];
+
+ if (scene !== undefined) {
+ this.interpreter.resolve(this.interpreter.records.scenes[id]);
+ } else {
+ throw `Scene specified [${id}] isn't defined on the Scribe's program.`;
+ }
+ }
+
+ public async interact(id: string): Promise {
+ if (this.interactions.has(id) === false) {
+ this.interactions.set(id, {
+ cleanup: undefined,
+ lastInteraction: 0,
+ queue: new Array(),
+ });
+ }
+
+ // eslint-disable-next-line prefer-const
+ let { cleanup, lastInteraction, queue } = this.interactions.get(id)!;
+
+ if (cleanup !== undefined) {
+ cleanup.Disconnect();
+ }
+
+ const interaction = this.interpreter.records.interactions[id];
+ if (os.clock() - lastInteraction > this.interactionsCooldown && queue.size() === 0) {
+ lastInteraction = os.clock();
+
+ return this.interpreter.resolve(interaction);
+ } else {
+ queue.push(interaction);
+
+ // eslint-disable-next-line no-constant-condition
+ while (true) {
+ if (os.clock() - lastInteraction > this.interactionsCooldown && queue[1] === interaction) {
+ this.clean(id);
+
+ return this.interpreter.resolve(interaction);
+ } else {
+ task.wait();
+ }
+ }
+ }
+ }
+
+ private clean(id: string): void {
+ const interactionJob = this.interactions.get(id);
+
+ if (interactionJob !== undefined) {
+ const { cleanup, lastInteraction, queue } = interactionJob;
+
+ if (cleanup !== undefined) {
+ interactionJob.cleanup = RunService.PostSimulation.Connect(() => {
+ if (os.clock() - lastInteraction > this.interactionsCooldown && queue.size() === 0) {
+ if (this.interactions.has(id)) {
+ this.interactions.delete(id);
+ }
+
+ cleanup.Disconnect();
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/src/ast-interpreter/types.d.ts b/src/runtime/types.d.ts
similarity index 81%
rename from src/ast-interpreter/types.d.ts
rename to src/runtime/types.d.ts
index 55c8608..f6ffaaf 100644
--- a/src/ast-interpreter/types.d.ts
+++ b/src/runtime/types.d.ts
@@ -2,7 +2,20 @@ import { Statement } from "@aethergames/mkscribe";
import { TokenLiteral } from "@aethergames/mkscribe/out/mkscribe/scanner/types";
import { StatusInterpretationCode } from "./visitor";
-declare type ScribeProperties = "title" | "description";
+export declare type InteractionJob = {
+ cleanup: RBXScriptConnection | undefined;
+ lastInteraction: number;
+ queue: Array;
+};
+
+export declare type ScribeProperties = "title" | "description";
+
+export declare type Objective = {
+ id: number;
+ name: string;
+ desc: string;
+ active: boolean;
+};
export declare type ScribeProgramProperties = Record;
@@ -23,6 +36,11 @@ export declare type DialogCallbackInput = {
step: (id?: number) => void;
};
+export declare type ObjectiveChangeCallbackInput = {
+ id: string;
+ description: string;
+};
+
export declare type PipeToCallbackInput = {
identifier: string;
data: unknown;
@@ -52,6 +70,13 @@ export interface ScribeRuntimeImplementation {
*/
start(): StatusInterpretationCode;
+ getObjective(objective: string): Objective | undefined;
+
+ /**
+ *
+ */
+ getCurrentObjective(): Objective | undefined;
+
/**
* Retrieve's a property's value.
*
diff --git a/src/ast-interpreter/utils/index.ts b/src/runtime/utils/index.ts
similarity index 100%
rename from src/ast-interpreter/utils/index.ts
rename to src/runtime/utils/index.ts
diff --git a/src/ast-interpreter/utils/types.d.ts b/src/runtime/utils/types.d.ts
similarity index 100%
rename from src/ast-interpreter/utils/types.d.ts
rename to src/runtime/utils/types.d.ts
diff --git a/src/ast-interpreter/visitor/index.ts b/src/runtime/visitor/index.ts
similarity index 91%
rename from src/ast-interpreter/visitor/index.ts
rename to src/runtime/visitor/index.ts
index bf4ebe3..f968b9b 100644
--- a/src/ast-interpreter/visitor/index.ts
+++ b/src/runtime/visitor/index.ts
@@ -31,7 +31,13 @@ import {
} from "@aethergames/mkscribe/out/mkscribe/ast/types";
import { TokenLiteral } from "@aethergames/mkscribe/out/mkscribe/scanner/types";
import { ScribeEnviroment } from "../../types";
-import { DialogCallbackInput, OptionStructure, PipeToCallbackInput } from "../types";
+import {
+ DialogCallbackInput,
+ Objective,
+ ObjectiveChangeCallbackInput,
+ OptionStructure,
+ PipeToCallbackInput,
+} from "../types";
import { EventListener } from "../utils";
import { Interpreter, RefNode } from "./types";
@@ -46,12 +52,14 @@ export class ScribeVisitor implements Interpreter {
public refs: Record;
public records: {
+ objectivesCurrentId: 0;
+
actors: Record;
stores: Record]>;
objectives: {
- current?: TokenLiteral;
- } & { [x: string]: TokenLiteral };
+ current?: string;
+ } & { [x: string]: Objective };
scenes: Record;
interactions: Record;
@@ -68,8 +76,9 @@ export class ScribeVisitor implements Interpreter {
constructor(
private readonly ast: Array,
private readonly callbacks: {
- dialog: (input: DialogCallbackInput) => void;
- storeChange: (config: PipeToCallbackInput) => void;
+ onDialog: (input: DialogCallbackInput) => void;
+ onStoreChange: (config: PipeToCallbackInput) => void;
+ onObjectiveChange: (input: ObjectiveChangeCallbackInput) => void;
},
private env: ScribeEnviroment,
) {
@@ -77,6 +86,8 @@ export class ScribeVisitor implements Interpreter {
this.refs = {};
this.records = {
+ objectivesCurrentId: 0,
+
actors: {},
stores: {},
objectives: {},
@@ -267,7 +278,7 @@ export class ScribeVisitor implements Interpreter {
}
}
- public visitEnviromentAccessor(expr: EnvironmentAccessor): TokenLiteral {
+ public visitEnvironmentAccessor(expr: EnvironmentAccessor): TokenLiteral {
const lexeme = expr.name.literal as string;
return this.env[lexeme.sub(2, lexeme.size())] as TokenLiteral;
}
@@ -305,6 +316,10 @@ export class ScribeVisitor implements Interpreter {
if (identifier in this.records.objectives) {
this.records.objectives.current = identifier;
+ this.callbacks.onObjectiveChange({
+ id: identifier,
+ description: this.records.objectives[identifier].desc,
+ });
} else {
this.resolve(this.records.scenes[identifier]);
}
@@ -337,13 +352,18 @@ export class ScribeVisitor implements Interpreter {
const objective = stmt.name.lexeme as string;
const objectiveDesc = this.evaluate(stmt.value);
- this.records.objectives[objective] = objectiveDesc;
-
if (isDefault && this.records.objectives.current === undefined) {
this.records.objectives.current = objective;
- } else {
+ } else if (isDefault && this.records.objectives.current !== undefined) {
throw `Another objective is already a default one, make sure to not override or have multiple default objectives. ${stmt.name.start}:${stmt.name.end}`;
}
+
+ this.records.objectives[objective] = {
+ id: ++this.records.objectivesCurrentId,
+ name: objective,
+ desc: objectiveDesc as string,
+ active: objective === this.records.objectives.current!,
+ };
}
public visitStoreStatement(stmt: StoreStatement): void {
@@ -386,7 +406,7 @@ export class ScribeVisitor implements Interpreter {
}
this.records.stores[ref][0] = refValue;
- this.callbacks.storeChange?.({ identifier: ref, data: refValue, metadata: metadata as never });
+ this.callbacks.onStoreChange?.({ identifier: ref, data: refValue, metadata: metadata as never });
this.tracker.event.notify(ref);
}
@@ -414,7 +434,7 @@ export class ScribeVisitor implements Interpreter {
}
task.spawn(() => {
- this.callbacks.dialog?.({
+ this.callbacks.onDialog?.({
characterIdentifier,
text,
metadata,
@@ -514,8 +534,9 @@ export class ScribeVisitor implements Interpreter {
public visitInteractStatement(stmt: InteractStatement): void {
const ref = stmt.identifier.lexeme as string;
const refValue = stmt.body;
+ const actor = this.records.actors[ref];
- this.records.interactions[ref] = refValue;
+ this.records.interactions[actor as string] = refValue;
}
public visitEchoStatement(stmt: EchoStatement): void {
diff --git a/src/ast-interpreter/visitor/types.d.ts b/src/runtime/visitor/types.d.ts
similarity index 100%
rename from src/ast-interpreter/visitor/types.d.ts
rename to src/runtime/visitor/types.d.ts
diff --git a/src/vm/chunk/index.ts b/src/vm/chunk/index.ts
deleted file mode 100644
index f486c1b..0000000
--- a/src/vm/chunk/index.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { FREE_ARRAY } from "../memory";
-import { int, uint8 } from "../types";
-import { buildValueArray, freeValueArray, writeValueArray } from "../value";
-import { Value } from "../value/types";
-import { Chunk } from "./types";
-
-/**
- * Used to create a Chunk.
- *
- * @param chunk a Chunk
- */
-export function buildChunk(): Chunk {
- return {
- code: table.create(8),
- constants: buildValueArray(),
- };
-}
-
-/**
- * Used to free a Chunk's memory.
- *
- * @param chunk a Chunk
- */
-export function freeChunk(chunk: Chunk): void {
- FREE_ARRAY(chunk.code);
- freeValueArray(chunk.constants);
-}
-
-/**
- * Used to write/insert data to a Chunk's code.
- *
- * @param chunk a Chunk
- * @param byte a byte of data
- */
-export function writeChunk(chunk: Chunk, byte: uint8): void {
- chunk.code.push(byte);
-}
-
-/**
- * Used to store/add constants to the ValueArray.
- *
- * @param chunk a Chunk
- * @param value a valid Value type
- */
-export function addConstant(chunk: Chunk, value: Value): int {
- writeValueArray(chunk.constants, value);
-
- return chunk.constants.values.size() - 1;
-}
diff --git a/src/vm/chunk/types.d.ts b/src/vm/chunk/types.d.ts
deleted file mode 100644
index fa04add..0000000
--- a/src/vm/chunk/types.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { uint8_t } from "../types";
-import { ValueArray } from "../value/types";
-
-export declare interface Chunk {
- code: uint8_t;
- constants: ValueArray;
-}
diff --git a/src/vm/debug/index.ts b/src/vm/debug/index.ts
deleted file mode 100644
index 4810b10..0000000
--- a/src/vm/debug/index.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Chunk } from "../chunk/types";
-import { OpCode } from "../op_codes";
-import { int, uint8 } from "../types";
-
-function formatInstruction(name: string, offset: int): int {
- print(`| ${"%04d".format(offset)} ${name}\n`);
-
- return offset + 1;
-}
-
-function disasembleInstruction(chunk: Chunk, offset: int): int {
- const instruction: uint8 = chunk.code[offset];
-
- switch (instruction) {
- case OpCode.OP_RETURN: {
- return formatInstruction("OP_RETURN", offset);
- }
-
- case OpCode.OP_ADD: {
- return formatInstruction("OP_ADD", offset);
- }
-
- default: {
- return offset + 1;
- }
- }
-}
-
-export function disassembleChunk(chunk: Chunk, name: string): void {
- print(`Disassembling ${name}\n`);
-
- for (let offset = 0; offset < chunk.code.size(); ) {
- offset = disasembleInstruction(chunk, offset);
- }
-}
diff --git a/src/vm/debug/types.d.ts b/src/vm/debug/types.d.ts
deleted file mode 100644
index ca4eb38..0000000
--- a/src/vm/debug/types.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { Chunk } from "../chunk/types";
-import { int } from "../types";
-
-declare function disassembleChunk(chunk: Chunk, name: string): void;
-declare function disasembleInstruction(chunk: Chunk, offset: int): void;
diff --git a/src/vm/index.ts b/src/vm/index.ts
deleted file mode 100644
index ae26440..0000000
--- a/src/vm/index.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { ScribeEnviroment } from "../types";
-import { Chunk } from "./chunk/types";
-import { OpCode } from "./op_codes";
-import { uint8 } from "./types";
-import { Value } from "./value/types";
-
-enum InterpreterStatusCode {
- SUCCESS,
- ERROR,
- RUNTIME_ERROR,
-}
-
-export class ScribeVM {
- private chunk!: Chunk;
- private ip: uint8 = 0;
-
- // public status_code: InterpreterStatusCode;
-
- constructor(private readonly source: string, env: ScribeEnviroment) {
- // this.status_code = this.interpret();
- }
-
- public interpret(chunk: Chunk): InterpreterStatusCode {
- this.chunk = chunk;
-
- for (;;) {
- let instruction: uint8;
-
- switch ((instruction = this.read_byte())) {
- case OpCode.OP_CONSTANT: {
- const constant: Value = this.read_constant();
-
- break;
- }
-
- case OpCode.OP_RETURN: {
- return InterpreterStatusCode.SUCCESS;
- }
- }
- }
- }
-
- private freeze(): void {}
-
- private cache(): void {}
-
- private read_byte(): uint8 {
- const byte = this.chunk.code[this.ip];
- this.ip++;
-
- return byte;
- }
-
- private read_constant(): Value {
- return this.chunk.constants.values[this.ip];
- }
-}
diff --git a/src/vm/memory/index.ts b/src/vm/memory/index.ts
deleted file mode 100644
index 5883494..0000000
--- a/src/vm/memory/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { ScribeVM } from "..";
-
-export function FREE_ARRAY(array: object): void {
- return table.clear(array);
-}
-
-export function FREE_VM(vm: ScribeVM): void {
- return table.clear(vm);
-}
diff --git a/src/vm/op_codes/index.ts b/src/vm/op_codes/index.ts
deleted file mode 100644
index dcacc44..0000000
--- a/src/vm/op_codes/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * The OPCodes for ScribeVM.
- */
-export enum OpCode {
- OP_CONSTANT,
- OP_ADD,
- OP_SUB,
- OP_RETURN,
-}
diff --git a/src/vm/types.d.ts b/src/vm/types.d.ts
deleted file mode 100644
index f5ea597..0000000
--- a/src/vm/types.d.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export declare type int = number;
-export declare type uint8 = number;
-
-export declare type uint8_t = Array;
diff --git a/src/vm/value/index.ts b/src/vm/value/index.ts
deleted file mode 100644
index 73e666f..0000000
--- a/src/vm/value/index.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { FREE_ARRAY } from "../memory";
-import { Value, ValueArray } from "./types";
-
-/**
- * Used to create a Chunk.
- *
- * @param chunk a Chunk
- */
-export function buildValueArray(): ValueArray {
- return {
- values: table.create(8),
- };
-}
-
-/**
- * Used to free a Chunk's memory.
- *
- * @param value_array a Chunk
- */
-export function freeValueArray(value_array: ValueArray): void {
- FREE_ARRAY(value_array.values);
-}
-
-/**
- * Used to write/insert data to a Chunk's code.
- *
- * @param value_array a Chunk
- * @param byte a byte of data
- */
-export function writeValueArray(value_array: ValueArray, byte: Value): void {
- value_array.values.push(byte);
-}
diff --git a/src/vm/value/types.d.ts b/src/vm/value/types.d.ts
deleted file mode 100644
index b779f98..0000000
--- a/src/vm/value/types.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export declare type Value = number;
-
-export declare interface ValueArray {
- values: Array;
-}
diff --git a/test.project.json b/test.project.json
index 2849b4b..2c84ac2 100644
--- a/test.project.json
+++ b/test.project.json
@@ -1,5 +1,5 @@
{
- "name": "rbxts.scribe-as-game",
+ "name": "rbxts-scribe-as-game",
"globIgnorePaths": ["**/package.json", "**/tsconfig.json"],
"tree": {
diff --git a/testez-companion.toml b/testez-companion.toml
new file mode 100644
index 0000000..ec9b156
--- /dev/null
+++ b/testez-companion.toml
@@ -0,0 +1,2 @@
+# These are the locations of your .spec files (descendants are searched too)
+roots = ["ServerScriptService/Package"]