overpy 9.6.8 → 9.6.10
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 +164 -42
- package/package.json +1 -1
package/overpy.js
CHANGED
|
@@ -4187,8 +4187,7 @@ var mapKw = (
|
|
|
4187
4187
|
"skirmish"
|
|
4188
4188
|
],
|
|
4189
4189
|
"variants": {
|
|
4190
|
-
"
|
|
4191
|
-
"morning": "972777519512068154"
|
|
4190
|
+
"default": "972777519512099996"
|
|
4192
4191
|
},
|
|
4193
4192
|
"en-US": "Watchpoint: Gibraltar",
|
|
4194
4193
|
"es-ES": "Observatorio: Gibraltar",
|
|
@@ -39408,7 +39407,8 @@ function addSubroutine(content, index, fileStack7, isFromDefStatement = false) {
|
|
|
39408
39407
|
name: content,
|
|
39409
39408
|
index: index ?? subroutines.length,
|
|
39410
39409
|
fileStack: fileStack7,
|
|
39411
|
-
isFromDefStatement
|
|
39410
|
+
isFromDefStatement,
|
|
39411
|
+
callsSubroutines: []
|
|
39412
39412
|
});
|
|
39413
39413
|
}
|
|
39414
39414
|
function translateNameToAvoidKeywords(initialName, nameType) {
|
|
@@ -43906,6 +43906,23 @@ astParsingFunctions.__assignTo__ = function(content) {
|
|
|
43906
43906
|
return content;
|
|
43907
43907
|
};
|
|
43908
43908
|
|
|
43909
|
+
// src/compiler/functions/__callSubroutine__.ts
|
|
43910
|
+
astParsingFunctions.__callSubroutine__ = function(content) {
|
|
43911
|
+
let parent = content.parent;
|
|
43912
|
+
while (parent?.parent) {
|
|
43913
|
+
parent = parent.parent;
|
|
43914
|
+
}
|
|
43915
|
+
if (parent?.name === "__rule__") {
|
|
43916
|
+
if (parent.ruleAttributes?.subroutineName) {
|
|
43917
|
+
let subroutine = subroutines.find((x) => x.name === parent.ruleAttributes?.subroutineName);
|
|
43918
|
+
if (!subroutine.callsSubroutines.includes(content.args[0].name)) {
|
|
43919
|
+
subroutine.callsSubroutines.push(content.args[0].name);
|
|
43920
|
+
}
|
|
43921
|
+
}
|
|
43922
|
+
}
|
|
43923
|
+
return content;
|
|
43924
|
+
};
|
|
43925
|
+
|
|
43909
43926
|
// src/compiler/functions/__customString__.ts
|
|
43910
43927
|
astParsingFunctions.__customString__ = function(content) {
|
|
43911
43928
|
if (!content.stringTokens) {
|
|
@@ -46022,6 +46039,9 @@ astParsingFunctions.asinDeg = function(content) {
|
|
|
46022
46039
|
return content;
|
|
46023
46040
|
};
|
|
46024
46041
|
|
|
46042
|
+
// src/compiler/functions/async.ts
|
|
46043
|
+
astParsingFunctions.async = astParsingFunctions.__callSubroutine__;
|
|
46044
|
+
|
|
46025
46045
|
// src/compiler/functions/atan2.ts
|
|
46026
46046
|
astParsingFunctions.atan2 = function(content) {
|
|
46027
46047
|
if (enableOptimization) {
|
|
@@ -46042,14 +46062,6 @@ astParsingFunctions.atan2Deg = function(content) {
|
|
|
46042
46062
|
return content;
|
|
46043
46063
|
};
|
|
46044
46064
|
|
|
46045
|
-
// src/compiler/functions/attacker.ts
|
|
46046
|
-
astParsingFunctions.attacker = function(content) {
|
|
46047
|
-
if (["global", "eachPlayer", "playerDealtHealing", "playerReceivedHealing", "playerJoined", "playerLeft"].includes(currentRuleEvent)) {
|
|
46048
|
-
error("Cannot use '" + content.name + "' with rule event '" + currentRuleEvent + "'");
|
|
46049
|
-
}
|
|
46050
|
-
return content;
|
|
46051
|
-
};
|
|
46052
|
-
|
|
46053
46065
|
// src/compiler/functions/break.ts
|
|
46054
46066
|
astParsingFunctions.break = function(content) {
|
|
46055
46067
|
let innermostStructure = content.parent;
|
|
@@ -46595,12 +46607,88 @@ astParsingFunctions.dotProduct = function(content) {
|
|
|
46595
46607
|
|
|
46596
46608
|
// src/compiler/functions/eventPlayer.ts
|
|
46597
46609
|
astParsingFunctions.eventPlayer = function(content) {
|
|
46598
|
-
|
|
46599
|
-
|
|
46610
|
+
let categories = {
|
|
46611
|
+
eventPlayer: ["player"],
|
|
46612
|
+
attacker: ["damage"],
|
|
46613
|
+
victim: ["damage"],
|
|
46614
|
+
eventDamage: ["damage"],
|
|
46615
|
+
eventWasEnvironment: ["damage"],
|
|
46616
|
+
healer: ["healing"],
|
|
46617
|
+
healee: ["healing"],
|
|
46618
|
+
eventHealing: ["healing"],
|
|
46619
|
+
eventWasHealthPack: ["healing"],
|
|
46620
|
+
eventWasCriticalHit: ["damageOrHealing"],
|
|
46621
|
+
eventAbility: ["damageOrHealing"],
|
|
46622
|
+
eventDirection: ["damageOrHealing"]
|
|
46623
|
+
}[content.name];
|
|
46624
|
+
let ruleEventCategories = getRuleEventCategories(currentRuleEvent);
|
|
46625
|
+
if (currentRuleEvent === "__subroutine__") {
|
|
46626
|
+
let parent = content.parent;
|
|
46627
|
+
while (parent?.parent) {
|
|
46628
|
+
parent = parent.parent;
|
|
46629
|
+
}
|
|
46630
|
+
if (parent?.name === "__rule__") {
|
|
46631
|
+
if (parent.ruleAttributes?.subroutineName) {
|
|
46632
|
+
let subroutine = subroutines.find((x) => x.name === parent.ruleAttributes?.subroutineName);
|
|
46633
|
+
if (categories?.includes("player")) {
|
|
46634
|
+
subroutine.hasEventPlayerVars = true;
|
|
46635
|
+
}
|
|
46636
|
+
if (categories?.includes("damage")) {
|
|
46637
|
+
subroutine.hasEventDamageVars = true;
|
|
46638
|
+
}
|
|
46639
|
+
if (categories?.includes("healing")) {
|
|
46640
|
+
subroutine.hasEventHealingVars = true;
|
|
46641
|
+
}
|
|
46642
|
+
if (categories?.includes("damageOrHealing")) {
|
|
46643
|
+
subroutine.hasEventDamageOrHealingVars = true;
|
|
46644
|
+
}
|
|
46645
|
+
}
|
|
46646
|
+
}
|
|
46647
|
+
} else {
|
|
46648
|
+
if (ruleEventCategories && categories && !categories.some((c) => ruleEventCategories.includes(c))) {
|
|
46649
|
+
if (["eventPlayer", "attacker", "victim", "healer", "healee"].includes(content.name)) {
|
|
46650
|
+
error("Cannot use '" + content.name + "' with rule event '" + currentRuleEvent + "'");
|
|
46651
|
+
} else {
|
|
46652
|
+
warn("w_mismatched_event", "Cannot use '" + content.name + "' with rule event '" + currentRuleEvent + "'");
|
|
46653
|
+
}
|
|
46654
|
+
}
|
|
46600
46655
|
}
|
|
46601
46656
|
return content;
|
|
46602
46657
|
};
|
|
46603
46658
|
|
|
46659
|
+
// src/compiler/functions/attacker.ts
|
|
46660
|
+
astParsingFunctions.attacker = astParsingFunctions.eventPlayer;
|
|
46661
|
+
|
|
46662
|
+
// src/compiler/functions/eventAbility.ts
|
|
46663
|
+
astParsingFunctions.eventAbility = astParsingFunctions.eventPlayer;
|
|
46664
|
+
|
|
46665
|
+
// src/compiler/functions/eventDamage.ts
|
|
46666
|
+
astParsingFunctions.eventDamage = astParsingFunctions.eventPlayer;
|
|
46667
|
+
|
|
46668
|
+
// src/compiler/functions/eventDirection.ts
|
|
46669
|
+
astParsingFunctions.eventDirection = astParsingFunctions.eventPlayer;
|
|
46670
|
+
|
|
46671
|
+
// src/compiler/functions/eventHealing.ts
|
|
46672
|
+
astParsingFunctions.eventHealing = astParsingFunctions.eventPlayer;
|
|
46673
|
+
|
|
46674
|
+
// src/compiler/functions/eventWasCriticalHit.ts
|
|
46675
|
+
astParsingFunctions.eventWasCriticalHit = astParsingFunctions.eventPlayer;
|
|
46676
|
+
|
|
46677
|
+
// src/compiler/functions/eventWasEnvironment.ts
|
|
46678
|
+
astParsingFunctions.eventWasEnvironment = astParsingFunctions.eventPlayer;
|
|
46679
|
+
|
|
46680
|
+
// src/compiler/functions/eventWasHealthPack.ts
|
|
46681
|
+
astParsingFunctions.eventWasHealthPack = astParsingFunctions.eventPlayer;
|
|
46682
|
+
|
|
46683
|
+
// src/compiler/functions/healee.ts
|
|
46684
|
+
astParsingFunctions.healee = astParsingFunctions.eventPlayer;
|
|
46685
|
+
|
|
46686
|
+
// src/compiler/functions/healer.ts
|
|
46687
|
+
astParsingFunctions.healer = astParsingFunctions.eventPlayer;
|
|
46688
|
+
|
|
46689
|
+
// src/compiler/functions/victim.ts
|
|
46690
|
+
astParsingFunctions.victim = astParsingFunctions.eventPlayer;
|
|
46691
|
+
|
|
46604
46692
|
// src/compiler/functions/floor.ts
|
|
46605
46693
|
astParsingFunctions.floor = function(content) {
|
|
46606
46694
|
if (enableOptimization) {
|
|
@@ -46655,22 +46743,6 @@ astParsingFunctions.getOppositeTeam = function(content) {
|
|
|
46655
46743
|
return content;
|
|
46656
46744
|
};
|
|
46657
46745
|
|
|
46658
|
-
// src/compiler/functions/healee.ts
|
|
46659
|
-
astParsingFunctions.healee = function(content) {
|
|
46660
|
-
if (["global", "eachPlayer", "playerTookDamage", "playerDealtDamage", "playerDealtFinalBlow", "playerDied", "playerEarnedElimination", "playerJoined", "playerLeft", "playerDealtKnockback", "playerReceivedKnockback"].includes(currentRuleEvent)) {
|
|
46661
|
-
error("Cannot use '" + content.name + "' with rule event '" + currentRuleEvent + "'");
|
|
46662
|
-
}
|
|
46663
|
-
return content;
|
|
46664
|
-
};
|
|
46665
|
-
|
|
46666
|
-
// src/compiler/functions/healer.ts
|
|
46667
|
-
astParsingFunctions.healer = function(content) {
|
|
46668
|
-
if (["global", "eachPlayer", "playerTookDamage", "playerDealtDamage", "playerDealtFinalBlow", "playerDied", "playerEarnedElimination", "playerJoined", "playerLeft", "playerDealtKnockback", "playerReceivedKnockback"].includes(currentRuleEvent)) {
|
|
46669
|
-
error("Cannot use '" + content.name + "' with rule event '" + currentRuleEvent + "'");
|
|
46670
|
-
}
|
|
46671
|
-
return content;
|
|
46672
|
-
};
|
|
46673
|
-
|
|
46674
46746
|
// src/compiler/functions/hsl.ts
|
|
46675
46747
|
astParsingFunctions.hsl = function(content) {
|
|
46676
46748
|
let h = "$h";
|
|
@@ -47134,14 +47206,6 @@ astParsingFunctions.vectorTowards = function(content) {
|
|
|
47134
47206
|
return content;
|
|
47135
47207
|
};
|
|
47136
47208
|
|
|
47137
|
-
// src/compiler/functions/victim.ts
|
|
47138
|
-
astParsingFunctions.victim = function(content) {
|
|
47139
|
-
if (["global", "eachPlayer", "playerDealtHealing", "playerReceivedHealing", "playerJoined", "playerLeft"].includes(currentRuleEvent)) {
|
|
47140
|
-
error("Cannot use '" + content.name + "' with rule event '" + currentRuleEvent + "'");
|
|
47141
|
-
}
|
|
47142
|
-
return content;
|
|
47143
|
-
};
|
|
47144
|
-
|
|
47145
47209
|
// src/compiler/functions/wait.ts
|
|
47146
47210
|
astParsingFunctions.wait = function(content) {
|
|
47147
47211
|
if (enableOptimization && optimizeForSize2) {
|
|
@@ -47355,6 +47419,9 @@ function parseAstRules(rules) {
|
|
|
47355
47419
|
if (rule.ruleAttributes.name === void 0) {
|
|
47356
47420
|
rule.ruleAttributes.name = "Subroutine " + rule.ruleAttributes.subroutineName;
|
|
47357
47421
|
}
|
|
47422
|
+
if (defaultSubroutineNames.includes(rule.ruleAttributes.subroutineName)) {
|
|
47423
|
+
addSubroutine(rule.ruleAttributes.subroutineName, defaultSubroutineNames.indexOf(rule.ruleAttributes.subroutineName), rule.fileStack);
|
|
47424
|
+
}
|
|
47358
47425
|
rule.name = "__rule__";
|
|
47359
47426
|
rule.originalName = "__def__";
|
|
47360
47427
|
} else if (rule.name in astMacros) {
|
|
@@ -63979,6 +64046,7 @@ function astRulesToWs(rules) {
|
|
|
63979
64046
|
result += ") {\n";
|
|
63980
64047
|
result += tabLevel(1) + tows("__event__", ruleKw) + " {\n";
|
|
63981
64048
|
result += tabLevel(2) + tows(rule.ruleAttributes.event, eventKw) + ";\n";
|
|
64049
|
+
setCurrentRuleEvent(rule.ruleAttributes.event);
|
|
63982
64050
|
if (rule.ruleAttributes.eventTeam) {
|
|
63983
64051
|
result += tabLevel(2) + tows(rule.ruleAttributes.eventTeam, eventTeamKw) + ";\n";
|
|
63984
64052
|
}
|
|
@@ -64285,6 +64353,22 @@ function astToWs(content) {
|
|
|
64285
64353
|
}
|
|
64286
64354
|
}
|
|
64287
64355
|
}
|
|
64356
|
+
if (content.name === "async" || content.name === "__callSubroutine__") {
|
|
64357
|
+
let subroutineName = content.args[0].name;
|
|
64358
|
+
let subroutine = subroutines.find((s) => s.name === subroutineName);
|
|
64359
|
+
if (subroutine) {
|
|
64360
|
+
let categories = getRuleEventCategories(currentRuleEvent);
|
|
64361
|
+
if (subroutine.hasEventPlayerVars && !categories.includes("player")) {
|
|
64362
|
+
warn("w_mismatched_subroutine_event", "Calling subroutine " + subroutineName + ", which uses event player variables, from a " + currentRuleEvent + " rule", content.fileStack);
|
|
64363
|
+
} else if (subroutine.hasEventDamageOrHealingVars && !categories.includes("damageOrHealing")) {
|
|
64364
|
+
warn("w_mismatched_subroutine_event", "Calling subroutine " + subroutineName + ", which uses event damage or healing variables, from a " + currentRuleEvent + " rule", content.fileStack);
|
|
64365
|
+
} else if (subroutine.hasEventDamageVars && !categories.includes("damage")) {
|
|
64366
|
+
warn("w_mismatched_subroutine_event", "Calling subroutine " + subroutineName + ", which uses event damage variables, from a " + currentRuleEvent + " rule", content.fileStack);
|
|
64367
|
+
} else if (subroutine.hasEventHealingVars && !categories.includes("healing")) {
|
|
64368
|
+
warn("w_mismatched_subroutine_event", "Calling subroutine " + subroutineName + ", which uses event healing variables, from a " + currentRuleEvent + " rule", content.fileStack);
|
|
64369
|
+
}
|
|
64370
|
+
}
|
|
64371
|
+
}
|
|
64288
64372
|
if (content.name in equalityFuncToOpMapping) {
|
|
64289
64373
|
content.args.splice(1, 0, new Ast2(equalityFuncToOpMapping[content.name], [], [], "__Operator__"));
|
|
64290
64374
|
content.name = "__compare__";
|
|
@@ -65203,6 +65287,24 @@ function compileRules(astRules) {
|
|
|
65203
65287
|
if (DEBUG_MODE) {
|
|
65204
65288
|
console.log(parsedAstRules);
|
|
65205
65289
|
}
|
|
65290
|
+
let hasModification = false;
|
|
65291
|
+
do {
|
|
65292
|
+
hasModification = false;
|
|
65293
|
+
for (let subroutine of subroutines) {
|
|
65294
|
+
for (let calledSubroutineName of subroutine.callsSubroutines) {
|
|
65295
|
+
let calledSubroutine = subroutines.find((s) => s.name === calledSubroutineName);
|
|
65296
|
+
if (!calledSubroutine) {
|
|
65297
|
+
error("Subroutine '" + subroutine.name + "' calls unknown subroutine '" + calledSubroutineName + "'");
|
|
65298
|
+
}
|
|
65299
|
+
for (let key of ["hasEventPlayerVars", "hasEventDamageVars", "hasEventHealingVars", "hasEventDamageOrHealingVars"]) {
|
|
65300
|
+
if (calledSubroutine[key] && !subroutine[key]) {
|
|
65301
|
+
subroutine[key] = true;
|
|
65302
|
+
hasModification = true;
|
|
65303
|
+
}
|
|
65304
|
+
}
|
|
65305
|
+
}
|
|
65306
|
+
}
|
|
65307
|
+
} while (hasModification);
|
|
65206
65308
|
setOptimizationEnabled2(true);
|
|
65207
65309
|
setOptimizeStrict2(false);
|
|
65208
65310
|
setOptimizationForSize2(false);
|
|
@@ -65479,9 +65581,10 @@ function compileCustomGameSettings(customGameSettings) {
|
|
|
65479
65581
|
let mapVariants = mapKw[mapName].variants ?? {};
|
|
65480
65582
|
for (var variant of map[mapName]) {
|
|
65481
65583
|
if (!(variant in mapVariants)) {
|
|
65482
|
-
|
|
65584
|
+
variants.push(variant + "");
|
|
65585
|
+
} else {
|
|
65586
|
+
variants.push(mapVariants[variant]);
|
|
65483
65587
|
}
|
|
65484
|
-
variants.push(mapVariants[variant]);
|
|
65485
65588
|
}
|
|
65486
65589
|
encounteredMaps.push(mapName);
|
|
65487
65590
|
result[wsGamemodes][wsGamemode][wsMapsKey].push(tows(mapName, mapKw) + " " + variants.join(" "));
|
|
@@ -67675,6 +67778,24 @@ function getUniqueNumber() {
|
|
|
67675
67778
|
incrementUniqueNumber();
|
|
67676
67779
|
return uniqueNumber;
|
|
67677
67780
|
}
|
|
67781
|
+
function getRuleEventCategories(ruleEvent) {
|
|
67782
|
+
return {
|
|
67783
|
+
global: [],
|
|
67784
|
+
eachPlayer: ["player"],
|
|
67785
|
+
playerDealtDamage: ["player", "damage"],
|
|
67786
|
+
playerDealtFinalBlow: ["player", "damage"],
|
|
67787
|
+
playerDealtHealing: ["player", "healing"],
|
|
67788
|
+
playerDealtKnockback: ["player", "damageOrHealing", "damage", "healing"],
|
|
67789
|
+
playerDied: ["player", "damage"],
|
|
67790
|
+
playerEarnedElimination: ["player", "damage"],
|
|
67791
|
+
playerJoined: ["player"],
|
|
67792
|
+
playerLeft: ["player"],
|
|
67793
|
+
playerTookDamage: ["player", "damage"],
|
|
67794
|
+
playerReceivedHealing: ["player", "healing"],
|
|
67795
|
+
playerReceivedKnockback: ["player", "damageOrHealing", "damage", "healing"],
|
|
67796
|
+
__subroutine__: ["player", "damageOrHealing", "damage", "healing"]
|
|
67797
|
+
}[ruleEvent] || [];
|
|
67798
|
+
}
|
|
67678
67799
|
|
|
67679
67800
|
// src/types.d.ts
|
|
67680
67801
|
var ow_languages = /* @__PURE__ */ ((ow_languages2) => {
|
|
@@ -71034,11 +71155,12 @@ function decompileCustomGameSettings(content) {
|
|
|
71034
71155
|
for (var variant of variants) {
|
|
71035
71156
|
var variantName = Object.keys(mapKw[mapName].variants).filter((x) => mapKw[mapName].variants[x] === variant);
|
|
71036
71157
|
if (variantName.length === 0) {
|
|
71037
|
-
|
|
71158
|
+
mapVariants.push(variant);
|
|
71159
|
+
} else {
|
|
71160
|
+
mapVariants.push(variantName[0]);
|
|
71038
71161
|
}
|
|
71039
|
-
mapVariants.push(variantName[0]);
|
|
71040
71162
|
}
|
|
71041
|
-
if (mapVariants.length === Object.keys(mapKw[mapName].variants).length) {
|
|
71163
|
+
if (mapVariants.length === Object.keys(mapKw[mapName].variants).length && mapVariants.every((x) => Object.keys(mapKw[mapName].variants).includes(x))) {
|
|
71042
71164
|
result[opyCategory][opyGamemode][opyPropName].push(mapName);
|
|
71043
71165
|
} else {
|
|
71044
71166
|
var mapObj = {};
|
package/package.json
CHANGED