overpy 9.5.5 → 9.5.7
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/overpy.js +76 -42
- package/package.json +1 -1
package/overpy.js
CHANGED
|
@@ -45328,10 +45328,9 @@ astParsingFunctions.__raiseToPower__ = function(content) {
|
|
|
45328
45328
|
astParsingFunctions.__rule__ = function(content) {
|
|
45329
45329
|
var isRelativeGotoEncountered = false;
|
|
45330
45330
|
var isGotoEncountered = false;
|
|
45331
|
-
var hasMeaningfulInstructionBeenEncountered = false;
|
|
45332
45331
|
var declaredLabels = [];
|
|
45333
45332
|
function iterateOnRuleActions(children) {
|
|
45334
|
-
for (
|
|
45333
|
+
for (let i2 = 0; i2 < children.length; i2++) {
|
|
45335
45334
|
setFileStack(content.fileStack);
|
|
45336
45335
|
if (children[i2].name === "__skip__" && children[i2].args[0].name !== "__distanceTo__" || children[i2].name === "__skipIf__" && children[i2].args[1].name !== "__distanceTo__") {
|
|
45337
45336
|
isRelativeGotoEncountered = true;
|
|
@@ -45345,39 +45344,6 @@ astParsingFunctions.__rule__ = function(content) {
|
|
|
45345
45344
|
}
|
|
45346
45345
|
declaredLabels.push(content.name);
|
|
45347
45346
|
}
|
|
45348
|
-
if (!hasMeaningfulInstructionBeenEncountered && ![
|
|
45349
|
-
"__abortIf__",
|
|
45350
|
-
"__abortIfConditionIsFalse__",
|
|
45351
|
-
"__abortIfConditionIsTrue__",
|
|
45352
|
-
"break",
|
|
45353
|
-
"continue",
|
|
45354
|
-
"__disableOptimizations__",
|
|
45355
|
-
"__disableOptimizeForSize__",
|
|
45356
|
-
"__disableOptimizeStrict__",
|
|
45357
|
-
"__enableOptimizations__",
|
|
45358
|
-
"__enableOptimizeForSize__",
|
|
45359
|
-
"__enableOptimizeStrict__",
|
|
45360
|
-
"__else__",
|
|
45361
|
-
"__elif__",
|
|
45362
|
-
"__end__",
|
|
45363
|
-
//"__for__", //meaningful because it modifies the loop variable
|
|
45364
|
-
//"__forGlobalVariable__",
|
|
45365
|
-
//"__forPlayerVariable__",
|
|
45366
|
-
"__if__",
|
|
45367
|
-
"loop",
|
|
45368
|
-
"__loopIf__",
|
|
45369
|
-
"__loopIfConditionIsFalse__",
|
|
45370
|
-
"__loopIfConditionIsTrue__",
|
|
45371
|
-
"pass",
|
|
45372
|
-
"return",
|
|
45373
|
-
"__skip__",
|
|
45374
|
-
"__skipIf__",
|
|
45375
|
-
//"wait",
|
|
45376
|
-
"__while__"
|
|
45377
|
-
].includes(children[i2].name) && children[i2].type !== "Label" && !(children[i2].name === "wait" && content.ruleAttributes.event !== "__subroutine__")) {
|
|
45378
|
-
debug("meaningful instruction :" + children[i2].name);
|
|
45379
|
-
hasMeaningfulInstructionBeenEncountered = true;
|
|
45380
|
-
}
|
|
45381
45347
|
iterateOnRuleActions(children[i2].children);
|
|
45382
45348
|
if (!isRelativeGotoEncountered) {
|
|
45383
45349
|
if (children[i2].name === "pass") {
|
|
@@ -45397,7 +45363,14 @@ astParsingFunctions.__rule__ = function(content) {
|
|
|
45397
45363
|
}
|
|
45398
45364
|
}
|
|
45399
45365
|
if (isDefinitelyFalsy(children[i2].args[0]) && (children[i2].children.length === 0 || !isGotoEncountered)) {
|
|
45400
|
-
if (children[i2 + 1].name === "
|
|
45366
|
+
if (i2 === children.length - 1 || children[i2 + 1].name === "__end__") {
|
|
45367
|
+
children.splice(i2, 1);
|
|
45368
|
+
if (i2 < children.length && children[i2].name === "__end__") {
|
|
45369
|
+
children.splice(i2, 1);
|
|
45370
|
+
}
|
|
45371
|
+
i2--;
|
|
45372
|
+
continue;
|
|
45373
|
+
} else if (children[i2 + 1].name === "__else__") {
|
|
45401
45374
|
children[i2 + 1].name = "__if__";
|
|
45402
45375
|
children[i2 + 1].args = [getAstForTrue()];
|
|
45403
45376
|
children.splice(i2, 1);
|
|
@@ -45446,10 +45419,51 @@ astParsingFunctions.__rule__ = function(content) {
|
|
|
45446
45419
|
}
|
|
45447
45420
|
}
|
|
45448
45421
|
}
|
|
45422
|
+
function checkForMeaningfulInstructions(instructions) {
|
|
45423
|
+
for (let instruction of instructions) {
|
|
45424
|
+
if (![
|
|
45425
|
+
"__abortIf__",
|
|
45426
|
+
"__abortIfConditionIsFalse__",
|
|
45427
|
+
"__abortIfConditionIsTrue__",
|
|
45428
|
+
"break",
|
|
45429
|
+
"continue",
|
|
45430
|
+
"__disableOptimizations__",
|
|
45431
|
+
"__disableOptimizeForSize__",
|
|
45432
|
+
"__disableOptimizeStrict__",
|
|
45433
|
+
"__enableOptimizations__",
|
|
45434
|
+
"__enableOptimizeForSize__",
|
|
45435
|
+
"__enableOptimizeStrict__",
|
|
45436
|
+
"__else__",
|
|
45437
|
+
"__elif__",
|
|
45438
|
+
"__end__",
|
|
45439
|
+
//"__for__", //meaningful because it modifies the loop variable
|
|
45440
|
+
//"__forGlobalVariable__",
|
|
45441
|
+
//"__forPlayerVariable__",
|
|
45442
|
+
"__if__",
|
|
45443
|
+
"loop",
|
|
45444
|
+
"__loopIf__",
|
|
45445
|
+
"__loopIfConditionIsFalse__",
|
|
45446
|
+
"__loopIfConditionIsTrue__",
|
|
45447
|
+
"pass",
|
|
45448
|
+
"return",
|
|
45449
|
+
"__skip__",
|
|
45450
|
+
"__skipIf__",
|
|
45451
|
+
//"wait",
|
|
45452
|
+
"__while__"
|
|
45453
|
+
].includes(instruction.name) && instruction.type !== "Label" && !(instruction.name === "wait" && content.ruleAttributes.event !== "__subroutine__")) {
|
|
45454
|
+
debug("meaningful instruction :" + instruction.name);
|
|
45455
|
+
return true;
|
|
45456
|
+
}
|
|
45457
|
+
if (checkForMeaningfulInstructions(instruction.children)) {
|
|
45458
|
+
return true;
|
|
45459
|
+
}
|
|
45460
|
+
}
|
|
45461
|
+
return false;
|
|
45462
|
+
}
|
|
45449
45463
|
if (enableOptimization) {
|
|
45450
45464
|
iterateOnRuleActions(content.children);
|
|
45451
45465
|
}
|
|
45452
|
-
if (enableOptimization && !
|
|
45466
|
+
if (enableOptimization && !checkForMeaningfulInstructions(content.children) && !content.ruleAttributes.isDelimiter) {
|
|
45453
45467
|
return getAstForUselessInstruction();
|
|
45454
45468
|
}
|
|
45455
45469
|
function resolveDistanceTo(content2) {
|
|
@@ -47034,6 +47048,15 @@ astParsingFunctions.getClosestPlayer = function(content) {
|
|
|
47034
47048
|
return content;
|
|
47035
47049
|
};
|
|
47036
47050
|
|
|
47051
|
+
// src/compiler/functions/getCurrentMap.ts
|
|
47052
|
+
astParsingFunctions.getCurrentMap = function(content) {
|
|
47053
|
+
if (usedMaps.has("colosseo") || usedMaps.has("esperanca") || usedMaps.has("samoa")) {
|
|
47054
|
+
let buggedUsedMaps = ["colosseo", "esperanca", "samoa"].filter((m) => usedMaps.has(m));
|
|
47055
|
+
return parseOpyMacro(`[${buggedUsedMaps.map((m) => "Map." + m.toUpperCase()).join(", ")}, __getCurrentMap__()].filter(lambda x: "{}".format(__getCurrentMap__()) == x.split([]))[0]`, [], []);
|
|
47056
|
+
}
|
|
47057
|
+
return new Ast2("__getCurrentMap__");
|
|
47058
|
+
};
|
|
47059
|
+
|
|
47037
47060
|
// src/compiler/functions/getFarthestPlayer.ts
|
|
47038
47061
|
astParsingFunctions.getFarthestPlayer = function(content) {
|
|
47039
47062
|
warn("w_farthest_player", "The getFarthestPlayer() function targets dead and unspawned players (at 0,0,0). Use getRealFarthestPlayer() instead.");
|
|
@@ -61560,7 +61583,7 @@ var valueFuncKw = (
|
|
|
61560
61583
|
"th-TH": "Current Game Mode",
|
|
61561
61584
|
"zh-TW": "Current Game Mode"
|
|
61562
61585
|
},
|
|
61563
|
-
"
|
|
61586
|
+
"__getCurrentMap__": {
|
|
61564
61587
|
"guid": "00000000D418",
|
|
61565
61588
|
"description": "The current map of the custom game.",
|
|
61566
61589
|
"args": [],
|
|
@@ -65313,7 +65336,7 @@ rule "Disable inspector":
|
|
|
65313
65336
|
}
|
|
65314
65337
|
if (DEBUG_MODE) {
|
|
65315
65338
|
for (var elem of astRules) {
|
|
65316
|
-
console.log(
|
|
65339
|
+
console.log(astToString3(elem));
|
|
65317
65340
|
}
|
|
65318
65341
|
console.log(astRules);
|
|
65319
65342
|
}
|
|
@@ -66930,6 +66953,9 @@ function parseMember(object, member) {
|
|
|
66930
66953
|
if (astInfo.name === "__color__" && constantValues[astInfo.type][name]?.onlyInOverpy) {
|
|
66931
66954
|
return new Ast2("rgb", [getAstForNumber(constantValues[astInfo.type][name].red ?? 0), getAstForNumber(constantValues[astInfo.type][name].green ?? 0), getAstForNumber(constantValues[astInfo.type][name].blue ?? 0), getAstForNumber(constantValues[astInfo.type][name].alpha ?? 255)]);
|
|
66932
66955
|
}
|
|
66956
|
+
if (astInfo.name === "__map__") {
|
|
66957
|
+
usedMaps.add(name.toLowerCase());
|
|
66958
|
+
}
|
|
66933
66959
|
return new Ast2(astInfo.name, [new Ast2(name, [], [], astInfo.type)]);
|
|
66934
66960
|
} else if (object[0].text === "Math") {
|
|
66935
66961
|
if (name === "PI") {
|
|
@@ -67736,7 +67762,7 @@ function nthOfNumber(nb) {
|
|
|
67736
67762
|
return nb + "th";
|
|
67737
67763
|
}
|
|
67738
67764
|
}
|
|
67739
|
-
function
|
|
67765
|
+
function astToString3(ast, nbTabs2 = 0) {
|
|
67740
67766
|
var result = "";
|
|
67741
67767
|
if (ast === void 0) {
|
|
67742
67768
|
return "__undefined__";
|
|
@@ -67745,14 +67771,14 @@ function astToString2(ast, nbTabs2 = 0) {
|
|
|
67745
67771
|
if (ast.args === void 0) {
|
|
67746
67772
|
result += "(__undefined__)";
|
|
67747
67773
|
} else if (ast.args.length > 0) {
|
|
67748
|
-
result += "(" + ast.args.map((x) =>
|
|
67774
|
+
result += "(" + ast.args.map((x) => astToString3(x)).join(", ") + ")";
|
|
67749
67775
|
}
|
|
67750
67776
|
if (ast.children === void 0) {
|
|
67751
67777
|
result += ":__undefined__";
|
|
67752
67778
|
} else if (ast.children.length > 0) {
|
|
67753
67779
|
result += ":\n";
|
|
67754
67780
|
for (var child of ast.children) {
|
|
67755
|
-
result += tabLevel(nbTabs2 + 1) +
|
|
67781
|
+
result += tabLevel(nbTabs2 + 1) + astToString3(child, nbTabs2 + 1) + "\n";
|
|
67756
67782
|
}
|
|
67757
67783
|
}
|
|
67758
67784
|
return result;
|
|
@@ -68818,6 +68844,12 @@ Wrapping a string with \`___\` has the same caveats as putting a translated stri
|
|
|
68818
68844
|
class: "String",
|
|
68819
68845
|
return: "String"
|
|
68820
68846
|
},
|
|
68847
|
+
"getCurrentMap": {
|
|
68848
|
+
"description": "The current map of the custom game.",
|
|
68849
|
+
"args": [],
|
|
68850
|
+
"isConstant": true,
|
|
68851
|
+
"return": "Map"
|
|
68852
|
+
},
|
|
68821
68853
|
".getNormal": {
|
|
68822
68854
|
"description": "The surface normal at the raycast hit position (or from end pos to start pos if no hit occurs).",
|
|
68823
68855
|
"args": [
|
|
@@ -69198,6 +69230,7 @@ var activatedExtensions;
|
|
|
69198
69230
|
var setActivatedExtensions = (extensions) => activatedExtensions = extensions;
|
|
69199
69231
|
var availableExtensionPoints;
|
|
69200
69232
|
var setAvailableExtensionPoints = (points) => availableExtensionPoints = points;
|
|
69233
|
+
var usedMaps = /* @__PURE__ */ new Set();
|
|
69201
69234
|
var enableTagsSetup;
|
|
69202
69235
|
var setEnableTagsSetup = (enable) => enableTagsSetup = enable;
|
|
69203
69236
|
var translationLanguages2 = [];
|
|
@@ -69293,6 +69326,7 @@ function resetGlobalVariables(language) {
|
|
|
69293
69326
|
disableInspector = false;
|
|
69294
69327
|
keepUnusedTranslations = false;
|
|
69295
69328
|
disableTranslationSourceLines = false;
|
|
69329
|
+
usedMaps = /* @__PURE__ */ new Set();
|
|
69296
69330
|
postCompileHook = null;
|
|
69297
69331
|
}
|
|
69298
69332
|
var operatorPrecedence = {
|
package/package.json
CHANGED