overpy 9.5.6 → 9.5.8

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.
Files changed (2) hide show
  1. package/overpy.js +31 -1
  2. package/package.json +1 -1
package/overpy.js CHANGED
@@ -44761,6 +44761,13 @@ astParsingFunctions.__equals__ = function(content) {
44761
44761
  return content.args[1];
44762
44762
  }
44763
44763
  }
44764
+ if (content.args[0].name === "getCurrentMap" && content.args[1].name === "__map__") {
44765
+ if (["COLOSSEO", "ESPERANCA", "SAMOA"].includes(content.args[1].args[0].name)) {
44766
+ return parseOpyMacro(`"{}".format(__getCurrentMap__()) == "{}".format(Map.${content.args[1].args[0].name})`, [], []);
44767
+ } else {
44768
+ content.args[0].name = "__getCurrentMap__";
44769
+ }
44770
+ }
44764
44771
  return content;
44765
44772
  };
44766
44773
 
@@ -47048,6 +47055,18 @@ astParsingFunctions.getClosestPlayer = function(content) {
47048
47055
  return content;
47049
47056
  };
47050
47057
 
47058
+ // src/compiler/functions/getCurrentMap.ts
47059
+ astParsingFunctions.getCurrentMap = function(content) {
47060
+ if (content.parent?.name === "__equals__" && content.parent.args[1].name === "__map__") {
47061
+ return content;
47062
+ }
47063
+ if (usedMaps.has("colosseo") || usedMaps.has("esperanca") || usedMaps.has("samoa")) {
47064
+ let buggedUsedMaps = ["colosseo", "esperanca", "samoa"].filter((m) => usedMaps.has(m));
47065
+ return parseOpyMacro(`[${buggedUsedMaps.map((m) => "Map." + m.toUpperCase()).join(", ")}, __getCurrentMap__()].filter(lambda x: "{}".format(__getCurrentMap__()) == x.split([]))[0]`, [], []);
47066
+ }
47067
+ return new Ast2("__getCurrentMap__");
47068
+ };
47069
+
47051
47070
  // src/compiler/functions/getFarthestPlayer.ts
47052
47071
  astParsingFunctions.getFarthestPlayer = function(content) {
47053
47072
  warn("w_farthest_player", "The getFarthestPlayer() function targets dead and unspawned players (at 0,0,0). Use getRealFarthestPlayer() instead.");
@@ -61574,7 +61593,7 @@ var valueFuncKw = (
61574
61593
  "th-TH": "Current Game Mode",
61575
61594
  "zh-TW": "Current Game Mode"
61576
61595
  },
61577
- "getCurrentMap": {
61596
+ "__getCurrentMap__": {
61578
61597
  "guid": "00000000D418",
61579
61598
  "description": "The current map of the custom game.",
61580
61599
  "args": [],
@@ -66944,6 +66963,9 @@ function parseMember(object, member) {
66944
66963
  if (astInfo.name === "__color__" && constantValues[astInfo.type][name]?.onlyInOverpy) {
66945
66964
  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)]);
66946
66965
  }
66966
+ if (astInfo.name === "__map__") {
66967
+ usedMaps.add(name.toLowerCase());
66968
+ }
66947
66969
  return new Ast2(astInfo.name, [new Ast2(name, [], [], astInfo.type)]);
66948
66970
  } else if (object[0].text === "Math") {
66949
66971
  if (name === "PI") {
@@ -68832,6 +68854,12 @@ Wrapping a string with \`___\` has the same caveats as putting a translated stri
68832
68854
  class: "String",
68833
68855
  return: "String"
68834
68856
  },
68857
+ "getCurrentMap": {
68858
+ "description": "The current map of the custom game.",
68859
+ "args": [],
68860
+ "isConstant": true,
68861
+ "return": "Map"
68862
+ },
68835
68863
  ".getNormal": {
68836
68864
  "description": "The surface normal at the raycast hit position (or from end pos to start pos if no hit occurs).",
68837
68865
  "args": [
@@ -69212,6 +69240,7 @@ var activatedExtensions;
69212
69240
  var setActivatedExtensions = (extensions) => activatedExtensions = extensions;
69213
69241
  var availableExtensionPoints;
69214
69242
  var setAvailableExtensionPoints = (points) => availableExtensionPoints = points;
69243
+ var usedMaps = /* @__PURE__ */ new Set();
69215
69244
  var enableTagsSetup;
69216
69245
  var setEnableTagsSetup = (enable) => enableTagsSetup = enable;
69217
69246
  var translationLanguages2 = [];
@@ -69307,6 +69336,7 @@ function resetGlobalVariables(language) {
69307
69336
  disableInspector = false;
69308
69337
  keepUnusedTranslations = false;
69309
69338
  disableTranslationSourceLines = false;
69339
+ usedMaps = /* @__PURE__ */ new Set();
69310
69340
  postCompileHook = null;
69311
69341
  }
69312
69342
  var operatorPrecedence = {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/Zezombye/overpy"
8
8
  },
9
9
  "description": "High-level language for the Overwatch Workshop, with decompilation and compilation.",
10
- "version": "9.5.6",
10
+ "version": "9.5.8",
11
11
  "readme": "README.md",
12
12
  "keywords": [
13
13
  "overpy",