overpy 9.4.23 → 9.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/overpy.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -764,6 +764,33 @@ You can use `len(GameStatus)` to have the amount of values in the enum and `Game
|
|
|
764
764
|
|
|
765
765
|
Note that enum members are inlined, so if you use a value such as `getAllPlayers()` that changes during a game, the value of the enum will also change.
|
|
766
766
|
|
|
767
|
+
## #!postCompileHook
|
|
768
|
+
|
|
769
|
+
Runs a JavaScript post-processing script after OverPy finishes compilation. This can effectively resolve certain compilation errors caused by language translation.
|
|
770
|
+
|
|
771
|
+
```hs
|
|
772
|
+
#!postCompileHook "hooks/postCompileHook.js"
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
### How it works:
|
|
776
|
+
|
|
777
|
+
- The compiled Workshop text is exposed to the script as a `content` variable.
|
|
778
|
+
- The final value produced by the script is used as the final compiled output.
|
|
779
|
+
- The hook path is resolved from the main file root path (the compile `rootPath`).
|
|
780
|
+
- Only one `#!postCompileHook` directive can be defined per compilation.
|
|
781
|
+
|
|
782
|
+
Example `hooks/postCompileHook.js`:
|
|
783
|
+
|
|
784
|
+
```js
|
|
785
|
+
content = content.replace(/abc/g, "def");
|
|
786
|
+
|
|
787
|
+
// If the last operation returns an interpreter object,
|
|
788
|
+
// force a plain string as final output.
|
|
789
|
+
content.toString();
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
The hook script does not need to declare a wrapper function; writing statements that transform `content` is enough.
|
|
793
|
+
|
|
767
794
|
# Advanced constructs
|
|
768
795
|
|
|
769
796
|
## Switches
|
package/overpy.js
CHANGED
|
@@ -169589,6 +169589,10 @@ var gamemodeKw = (
|
|
|
169589
169589
|
"zh-CN": "\u96EA\u7403\u6B7B\u6597",
|
|
169590
169590
|
"zh-TW": "\u96EA\u7403\u6B7B\u9B25\u5927\u4F5C\u6230"
|
|
169591
169591
|
},
|
|
169592
|
+
"stadium": {
|
|
169593
|
+
"en-US": "Stadium",
|
|
169594
|
+
"zh-CN": "\u51B3\u6597\u9886\u57DF"
|
|
169595
|
+
},
|
|
169592
169596
|
"tdm": {
|
|
169593
169597
|
"defaultTeam1Players": 4,
|
|
169594
169598
|
"defaultTeam2Players": 4,
|
|
@@ -196850,8 +196854,8 @@ var reinitInterpreter = (code) => {
|
|
|
196850
196854
|
|
|
196851
196855
|
// src/utils/other.ts
|
|
196852
196856
|
var import_standalone = __toESM(require_babel());
|
|
196853
|
-
var MAX_SCRIPT_STEP_COUNT =
|
|
196854
|
-
var MAX_SCRIPT_STACK_SIZE =
|
|
196857
|
+
var MAX_SCRIPT_STEP_COUNT = 655360;
|
|
196858
|
+
var MAX_SCRIPT_STACK_SIZE = 1e8;
|
|
196855
196859
|
var scriptCache = {};
|
|
196856
196860
|
function camelCaseToUpperCase(str) {
|
|
196857
196861
|
return str.split(/(?=[A-Z])/).join("_").toUpperCase();
|
package/package.json
CHANGED