mlogjs 0.1.9 → 0.2.0

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 (201) hide show
  1. package/README.md +1 -1
  2. package/build/Compiler.js +40 -13
  3. package/build/Compiler.js.map +1 -1
  4. package/build/Scope.js.map +1 -1
  5. package/build/bin.js +16 -9
  6. package/build/bin.js.map +1 -1
  7. package/build/handlers/BlockStatement.js.map +1 -1
  8. package/build/handlers/CallExpression.js.map +1 -1
  9. package/build/handlers/ForStatement.js.map +1 -1
  10. package/build/handlers/Function.js +6 -3
  11. package/build/handlers/Function.js.map +1 -1
  12. package/build/handlers/Identifier.js.map +1 -1
  13. package/build/handlers/IfStatement.js.map +1 -1
  14. package/build/handlers/Literal.js +3 -1
  15. package/build/handlers/Literal.js.map +1 -1
  16. package/build/handlers/Object.d.ts +1 -0
  17. package/build/handlers/Object.js +12 -1
  18. package/build/handlers/Object.js.map +1 -1
  19. package/build/handlers/OperationExpressions.js +2 -1
  20. package/build/handlers/OperationExpressions.js.map +1 -1
  21. package/build/handlers/Program.js.map +1 -1
  22. package/build/handlers/Statements.js +3 -1
  23. package/build/handlers/Statements.js.map +1 -1
  24. package/build/handlers/TemplateExpression.js.map +1 -1
  25. package/build/handlers/VariableDeclaration.js +43 -19
  26. package/build/handlers/VariableDeclaration.js.map +1 -1
  27. package/build/handlers/WhileStatement.js.map +1 -1
  28. package/build/handlers/index.js +5 -1
  29. package/build/handlers/index.js.map +1 -1
  30. package/build/index.js.map +1 -1
  31. package/build/instructions/AddressResolver.js +1 -2
  32. package/build/instructions/AddressResolver.js.map +1 -1
  33. package/build/instructions/ControlInstructions.js.map +1 -1
  34. package/build/instructions/EndInstruction.js.map +1 -1
  35. package/build/instructions/InstructionBase.js.map +1 -1
  36. package/build/instructions/JumpInstruction.js.map +1 -1
  37. package/build/instructions/OperationInstruction.js.map +1 -1
  38. package/build/instructions/SetCounterInstruction.js.map +1 -1
  39. package/build/instructions/SetInstruction.js.map +1 -1
  40. package/build/instructions/ZeroSpaceInstruction.js.map +1 -1
  41. package/build/instructions/index.js +5 -1
  42. package/build/instructions/index.js.map +1 -1
  43. package/build/macros/Blocks.js +15 -6
  44. package/build/macros/Blocks.js.map +1 -1
  45. package/build/macros/Building.d.ts +11 -0
  46. package/build/macros/Building.js +81 -0
  47. package/build/macros/Building.js.map +1 -0
  48. package/build/macros/Draw.js +7 -2
  49. package/build/macros/Draw.js.map +1 -1
  50. package/build/macros/Function.js.map +1 -1
  51. package/build/macros/Items.d.ts +5 -0
  52. package/build/macros/Items.js +20 -0
  53. package/build/macros/Items.js.map +1 -0
  54. package/build/macros/Liquids.d.ts +5 -0
  55. package/build/macros/Liquids.js +18 -0
  56. package/build/macros/Liquids.js.map +1 -0
  57. package/build/macros/Math.js +9 -9
  58. package/build/macros/Math.js.map +1 -1
  59. package/build/macros/Memory.d.ts +5 -0
  60. package/build/macros/Memory.js +61 -0
  61. package/build/macros/Memory.js.map +1 -0
  62. package/build/macros/Namespace.d.ts +21 -0
  63. package/build/macros/Namespace.js +98 -0
  64. package/build/macros/Namespace.js.map +1 -0
  65. package/build/macros/Other.d.ts +0 -3
  66. package/build/macros/Other.js +2 -11
  67. package/build/macros/Other.js.map +1 -1
  68. package/build/macros/RawValue.d.ts +5 -0
  69. package/build/macros/RawValue.js +16 -0
  70. package/build/macros/RawValue.js.map +1 -0
  71. package/build/macros/Symbol.d.ts +0 -0
  72. package/build/macros/Symbol.js +1 -0
  73. package/build/macros/Symbol.js.map +1 -0
  74. package/build/macros/SymbolNamespace.d.ts +0 -0
  75. package/build/macros/SymbolNamespace.js +1 -0
  76. package/build/macros/SymbolNamespace.js.map +1 -0
  77. package/build/macros/TypeFactory.js.map +1 -1
  78. package/build/macros/Units.d.ts +5 -0
  79. package/build/macros/Units.js +18 -0
  80. package/build/macros/Units.js.map +1 -0
  81. package/build/macros/Vars.d.ts +5 -0
  82. package/build/macros/Vars.js +18 -0
  83. package/build/macros/Vars.js.map +1 -0
  84. package/build/macros/commands/Asm.d.ts +5 -0
  85. package/build/macros/commands/Asm.js +21 -0
  86. package/build/macros/commands/Asm.js.map +1 -0
  87. package/build/macros/commands/Draw.d.ts +5 -0
  88. package/build/macros/commands/Draw.js +39 -0
  89. package/build/macros/commands/Draw.js.map +1 -0
  90. package/build/macros/commands/DrawFlush.d.ts +5 -0
  91. package/build/macros/commands/DrawFlush.js +17 -0
  92. package/build/macros/commands/DrawFlush.js.map +1 -0
  93. package/build/macros/commands/GetLink.d.ts +5 -0
  94. package/build/macros/commands/GetLink.js +21 -0
  95. package/build/macros/commands/GetLink.js.map +1 -0
  96. package/build/macros/commands/Lookup.d.ts +5 -0
  97. package/build/macros/commands/Lookup.js +24 -0
  98. package/build/macros/commands/Lookup.js.map +1 -0
  99. package/build/macros/commands/Print.d.ts +5 -0
  100. package/build/macros/commands/Print.js +14 -0
  101. package/build/macros/commands/Print.js.map +1 -0
  102. package/build/macros/commands/PrintFlush.d.ts +5 -0
  103. package/build/macros/commands/PrintFlush.js +17 -0
  104. package/build/macros/commands/PrintFlush.js.map +1 -0
  105. package/build/macros/commands/Radar.d.ts +7 -0
  106. package/build/macros/commands/Radar.js +61 -0
  107. package/build/macros/commands/Radar.js.map +1 -0
  108. package/build/macros/commands/Sensor.d.ts +5 -0
  109. package/build/macros/commands/Sensor.js +20 -0
  110. package/build/macros/commands/Sensor.js.map +1 -0
  111. package/build/macros/commands/UnitBind.d.ts +5 -0
  112. package/build/macros/commands/UnitBind.js +17 -0
  113. package/build/macros/commands/UnitBind.js.map +1 -0
  114. package/build/macros/commands/UnitControl.d.ts +5 -0
  115. package/build/macros/commands/UnitControl.js +68 -0
  116. package/build/macros/commands/UnitControl.js.map +1 -0
  117. package/build/macros/commands/UnitLocate.d.ts +5 -0
  118. package/build/macros/commands/UnitLocate.js +55 -0
  119. package/build/macros/commands/UnitLocate.js.map +1 -0
  120. package/build/macros/commands/UnitRadar.d.ts +5 -0
  121. package/build/macros/commands/UnitRadar.js +41 -0
  122. package/build/macros/commands/UnitRadar.js.map +1 -0
  123. package/build/macros/commands/Wait.d.ts +5 -0
  124. package/build/macros/commands/Wait.js +18 -0
  125. package/build/macros/commands/Wait.js.map +1 -0
  126. package/build/macros/commands/control.d.ts +5 -0
  127. package/build/macros/commands/control.js +25 -0
  128. package/build/macros/commands/control.js.map +1 -0
  129. package/build/macros/commands/index.d.ts +14 -0
  130. package/build/macros/commands/index.js +33 -0
  131. package/build/macros/commands/index.js.map +1 -0
  132. package/build/macros/commands/io.d.ts +8 -0
  133. package/build/macros/commands/io.js +47 -0
  134. package/build/macros/commands/io.js.map +1 -0
  135. package/build/macros/helpers/GetBuilding.d.ts +5 -0
  136. package/build/macros/helpers/GetBuilding.js +16 -0
  137. package/build/macros/helpers/GetBuilding.js.map +1 -0
  138. package/build/macros/helpers/GetVar.d.ts +5 -0
  139. package/build/macros/helpers/GetVar.js +16 -0
  140. package/build/macros/helpers/GetVar.js.map +1 -0
  141. package/build/macros/helpers/index.d.ts +2 -0
  142. package/build/{scopes → macros/helpers}/index.js +2 -3
  143. package/build/macros/helpers/index.js.map +1 -0
  144. package/build/macros/index.d.ts +4 -2
  145. package/build/macros/index.js +25 -3
  146. package/build/macros/index.js.map +1 -1
  147. package/build/operators.d.ts +3 -0
  148. package/build/operators.js +79 -16
  149. package/build/operators.js.map +1 -1
  150. package/build/types.js +5 -1
  151. package/build/types.js.map +1 -1
  152. package/build/utils.d.ts +1 -0
  153. package/build/utils.js +5 -1
  154. package/build/utils.js.map +1 -1
  155. package/build/values/BaseValue.js +13 -3
  156. package/build/values/BaseValue.js.map +1 -1
  157. package/build/values/FunctionValue.js +5 -2
  158. package/build/values/FunctionValue.js.map +1 -1
  159. package/build/values/LiteralValue.js +4 -5
  160. package/build/values/LiteralValue.js.map +1 -1
  161. package/build/values/ObjectValue.js.map +1 -1
  162. package/build/values/StoreValue.js.map +1 -1
  163. package/build/values/TempValue.js +16 -2
  164. package/build/values/TempValue.js.map +1 -1
  165. package/build/values/VoidValue.js.map +1 -1
  166. package/build/values/index.js +5 -1
  167. package/build/values/index.js.map +1 -1
  168. package/dist/bundle.js +1 -553
  169. package/lib/commands.d.ts +326 -0
  170. package/lib/eslib/index.d.ts +3 -0
  171. package/lib/eslib/lib.d.ts +9 -0
  172. package/lib/eslib/lib.es2015.collection.d.ts +89 -0
  173. package/lib/eslib/lib.es2015.core.d.ts +16 -0
  174. package/lib/eslib/lib.es2015.d.ts +30 -0
  175. package/lib/eslib/lib.es2015.generator.d.ts +79 -0
  176. package/lib/eslib/lib.es2015.iterable.d.ts +70 -0
  177. package/lib/eslib/lib.es5.d.ts +295 -0
  178. package/lib/eslib/lib.es6.d.ts +18 -0
  179. package/lib/globals.d.ts +328 -0
  180. package/lib/helpers.d.ts +23 -0
  181. package/lib/index.d.ts +7 -0
  182. package/lib/kinds.d.ts +36 -0
  183. package/lib/memory.d.ts +17 -0
  184. package/lib/traits.d.ts +121 -0
  185. package/lib/util.d.ts +32 -0
  186. package/package.json +21 -10
  187. package/.gitattributes +0 -2
  188. package/build/scopes/FunctionScope.d.ts +0 -5
  189. package/build/scopes/FunctionScope.js +0 -13
  190. package/build/scopes/FunctionScope.js.map +0 -1
  191. package/build/scopes/LoopScope.d.ts +0 -5
  192. package/build/scopes/LoopScope.js +0 -13
  193. package/build/scopes/LoopScope.js.map +0 -1
  194. package/build/scopes/Scope.d.ts +0 -36
  195. package/build/scopes/Scope.js +0 -93
  196. package/build/scopes/Scope.js.map +0 -1
  197. package/build/scopes/index.d.ts +0 -3
  198. package/build/scopes/index.js.map +0 -1
  199. package/mlogjs.d.ts +0 -72
  200. package/tsconfig.json +0 -22
  201. package/webpack.config.js +0 -22
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RawValueMacro = void 0;
4
+ const values_1 = require("../values");
5
+ const Function_1 = require("./Function");
6
+ class RawValueMacro extends Function_1.MacroFunction {
7
+ constructor(scope) {
8
+ super(scope, (name) => {
9
+ if (!(name instanceof values_1.LiteralValue) || typeof name.data !== "string")
10
+ throw new Error("The name of the building must be a string literal.");
11
+ return [new values_1.StoreValue(scope, name.data), []];
12
+ });
13
+ }
14
+ }
15
+ exports.RawValueMacro = RawValueMacro;
16
+ //# sourceMappingURL=RawValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RawValue.js","sourceRoot":"","sources":["../../src/macros/RawValue.ts"],"names":[],"mappings":";;;AACA,sCAAqD;AACrD,yCAA2C;AAE3C,MAAa,aAAc,SAAQ,wBAAa;IAC9C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE;YAC5B,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;gBAClE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;YAExE,OAAO,CAAC,IAAI,mBAAU,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AATD,sCASC"}
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=Symbol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Symbol.js","sourceRoot":"","sources":["../../src/macros/Symbol.ts"],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=SymbolNamespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SymbolNamespace.js","sourceRoot":"","sources":["../../src/macros/SymbolNamespace.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"TypeFactory.js","sourceRoot":"","sources":["../../src/macros/TypeFactory.ts"],"names":[],"mappings":";;;AACA,sCAAgE;AAChE,yCAA2C;AAE3C,MAAa,YAAa,SAAQ,wBAAa;IAC9C,YAAY,KAAa;QACxB,KAAK,CAAC,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE;YAC9B,IAAI,KAAK,YAAY,qBAAY,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAClE,OAAO,CAAC,IAAI,mBAAU,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AARD,oCAQC;AAED,MAAa,WAAY,SAAQ,wBAAa;IAC7C,YAAY,KAAa;QACxB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,kBAAS,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;CACD;AAJD,kCAIC"}
1
+ {"version":3,"file":"TypeFactory.js","sourceRoot":"","sources":["../../src/macros/TypeFactory.ts"],"names":[],"mappings":";;;AACA,sCAAgE;AAChE,yCAA2C;AAE3C,MAAa,YAAa,SAAQ,wBAAa;IAC7C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE;YAC7B,IAAI,KAAK,YAAY,qBAAY,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBACjE,OAAO,CAAC,IAAI,mBAAU,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YACjD,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAVD,oCAUC;AAED,MAAa,WAAY,SAAQ,wBAAa;IAC5C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,kBAAS,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;CACF;AAJD,kCAIC"}
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../types";
2
+ import { ObjectValue } from "../values";
3
+ export declare class UnitsMacro extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnitsMacro = void 0;
4
+ const _1 = require(".");
5
+ const values_1 = require("../values");
6
+ class UnitsMacro extends values_1.ObjectValue {
7
+ constructor(scope) {
8
+ super(scope, {
9
+ $get: new _1.MacroFunction(scope, prop => {
10
+ if (!(prop instanceof values_1.LiteralValue) || typeof prop.data !== "string")
11
+ throw new Error("Cannot use dynamic properties on object macros");
12
+ return [new values_1.StoreValue(scope, `@${prop.data}`), []];
13
+ }),
14
+ });
15
+ }
16
+ }
17
+ exports.UnitsMacro = UnitsMacro;
18
+ //# sourceMappingURL=Units.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Units.js","sourceRoot":"","sources":["../../src/macros/Units.ts"],"names":[],"mappings":";;;AAAA,wBAAkC;AAElC,sCAAkE;AAElE,MAAa,UAAW,SAAQ,oBAAW;IACzC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE;YACX,IAAI,EAAE,IAAI,gBAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;gBACpC,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;oBAClE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;gBACpE,OAAO,CAAC,IAAI,mBAAU,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACtD,CAAC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AAVD,gCAUC"}
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../types";
2
+ import { ObjectValue } from "../values";
3
+ export declare class VarsMacro extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VarsMacro = void 0;
4
+ const _1 = require(".");
5
+ const values_1 = require("../values");
6
+ class VarsMacro extends values_1.ObjectValue {
7
+ constructor(scope) {
8
+ super(scope, {
9
+ $get: new _1.MacroFunction(scope, prop => {
10
+ if (!(prop instanceof values_1.LiteralValue) || typeof prop.data !== "string")
11
+ throw new Error("Cannot use dynamic properties on object macros");
12
+ return [new values_1.StoreValue(scope, `@${prop.data}`), []];
13
+ }),
14
+ });
15
+ }
16
+ }
17
+ exports.VarsMacro = VarsMacro;
18
+ //# sourceMappingURL=Vars.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Vars.js","sourceRoot":"","sources":["../../src/macros/Vars.ts"],"names":[],"mappings":";;;AAAA,wBAAkC;AAElC,sCAAkE;AAElE,MAAa,SAAU,SAAQ,oBAAW;IACxC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE;YACX,IAAI,EAAE,IAAI,gBAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;gBACpC,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;oBAClE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;gBACpE,OAAO,CAAC,IAAI,mBAAU,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACtD,CAAC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AAVD,8BAUC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class Asm extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Asm = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ class Asm extends __1.MacroFunction {
8
+ constructor(scope) {
9
+ super(scope, (code) => {
10
+ console.log(code);
11
+ throw new Error("unfinished");
12
+ if (!(code instanceof values_1.StoreValue) &&
13
+ (!(code instanceof values_1.LiteralValue) || typeof code.data !== "number"))
14
+ throw new Error("The getlink index must be a number literal or a store");
15
+ const temp = new values_1.TempValue(scope);
16
+ return [temp, [new instructions_1.InstructionBase("getlink", temp, code)]];
17
+ });
18
+ }
19
+ }
20
+ exports.Asm = Asm;
21
+ //# sourceMappingURL=Asm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Asm.js","sourceRoot":"","sources":["../../../src/macros/commands/Asm.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAmE;AAEnE,MAAa,GAAI,SAAQ,iBAAa;IACpC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE;YAC5B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAC9B,IACE,CAAC,CAAC,IAAI,YAAY,mBAAU,CAAC;gBAC7B,CAAC,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAElE,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;YAClC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhBD,kBAgBC"}
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class Draw extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Draw = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const values_1 = require("../../values");
6
+ const Function_1 = require("../Function");
7
+ class Draw extends Function_1.MacroFunction {
8
+ constructor(scope) {
9
+ super(scope, (kind, ...args) => {
10
+ if (!(kind instanceof values_1.LiteralValue))
11
+ throw new Error("Draw kind must be literal.");
12
+ if ([
13
+ "clear",
14
+ "color",
15
+ "stroke",
16
+ "line",
17
+ "rect",
18
+ "lineRect",
19
+ "poly",
20
+ "linePoly",
21
+ "triangle",
22
+ "image",
23
+ ].indexOf(kind.data) === -1)
24
+ throw new Error("Draw kind must be valid");
25
+ return [
26
+ null,
27
+ [
28
+ new instructions_1.InstructionBase("draw", kind.data, ...args.map(v => {
29
+ if (v instanceof values_1.LiteralValue && typeof v.data === "string")
30
+ return v.data;
31
+ return v;
32
+ })),
33
+ ],
34
+ ];
35
+ });
36
+ }
37
+ }
38
+ exports.Draw = Draw;
39
+ //# sourceMappingURL=Draw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Draw.js","sourceRoot":"","sources":["../../../src/macros/commands/Draw.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AAErD,yCAA4C;AAC5C,0CAA4C;AAE5C,MAAa,IAAK,SAAQ,wBAAa;IACrC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,IAAY,EAAE,GAAG,IAAc,EAAE,EAAE;YAC/C,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAChD,IACE;gBACE,OAAO;gBACP,OAAO;gBACP,QAAQ;gBACR,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,MAAM;gBACN,UAAU;gBACV,UAAU;gBACV,OAAO;aACR,CAAC,OAAO,CAAC,IAAI,CAAC,IAAc,CAAC,KAAK,CAAC,CAAC;gBAErC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,OAAO;gBACL,IAAI;gBACJ;oBACE,IAAI,8BAAe,CACjB,MAAM,EACN,IAAI,CAAC,IAAc,EACnB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;wBACd,IAAI,CAAC,YAAY,qBAAY,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;4BACzD,OAAO,CAAC,CAAC,IAAI,CAAC;wBAChB,OAAO,CAAC,CAAC;oBACX,CAAC,CAAC,CACH;iBACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApCD,oBAoCC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class DrawFlush extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DrawFlush = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ class DrawFlush extends __1.MacroFunction {
8
+ constructor(scope) {
9
+ super(scope, (target) => {
10
+ if (!(target instanceof values_1.ObjectValue))
11
+ throw new Error("The drawflush target must be a building");
12
+ return [null, [new instructions_1.InstructionBase("drawflush", target)]];
13
+ });
14
+ }
15
+ }
16
+ exports.DrawFlush = DrawFlush;
17
+ //# sourceMappingURL=DrawFlush.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawFlush.js","sourceRoot":"","sources":["../../../src/macros/commands/DrawFlush.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAuD;AAEvD,MAAa,SAAU,SAAQ,iBAAa;IAC1C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,MAAc,EAAE,EAAE;YAC9B,IAAI,CAAC,CAAC,MAAM,YAAY,oBAAW,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AARD,8BAQC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class GetLink extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetLink = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ const Building_1 = require("../Building");
8
+ class GetLink extends __1.MacroFunction {
9
+ constructor(scope) {
10
+ super(scope, (index) => {
11
+ if (!(index instanceof values_1.StoreValue) &&
12
+ (!(index instanceof values_1.LiteralValue) || typeof index.data !== "number"))
13
+ throw new Error("The getlink index must be a number literal or a store");
14
+ const temp = new values_1.TempValue(scope);
15
+ const outBuild = new Building_1.Building(scope, temp.name);
16
+ return [outBuild, [new instructions_1.InstructionBase("getlink", temp, index)]];
17
+ });
18
+ }
19
+ }
20
+ exports.GetLink = GetLink;
21
+ //# sourceMappingURL=GetLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetLink.js","sourceRoot":"","sources":["../../../src/macros/commands/GetLink.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAmE;AACnE,0CAAuC;AAEvC,MAAa,OAAQ,SAAQ,iBAAa;IACxC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE;YAC7B,IACE,CAAC,CAAC,KAAK,YAAY,mBAAU,CAAC;gBAC9B,CAAC,CAAC,CAAC,KAAK,YAAY,qBAAY,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAEpE,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;YAClC,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAChD,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,8BAAe,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAfD,0BAeC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class Lookup extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Lookup = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ const validKinds = ["block", "unit", "item", "liquid"];
8
+ class Lookup extends __1.MacroFunction {
9
+ constructor(scope) {
10
+ super(scope, (kind, index) => {
11
+ if (!(kind instanceof values_1.LiteralValue && typeof kind.data === "string"))
12
+ throw new Error("The lookup kind must be a string literal");
13
+ if (!validKinds.includes(kind.data))
14
+ throw new Error("Invalid lookup kind");
15
+ if (!(index instanceof values_1.LiteralValue && typeof index.data === "number") &&
16
+ !(index instanceof values_1.StoreValue))
17
+ throw new Error("The lookup index must be a number literal or a store");
18
+ const temp = new values_1.TempValue(scope);
19
+ return [temp, [new instructions_1.InstructionBase("lookup", kind.data, temp, index)]];
20
+ });
21
+ }
22
+ }
23
+ exports.Lookup = Lookup;
24
+ //# sourceMappingURL=Lookup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lookup.js","sourceRoot":"","sources":["../../../src/macros/commands/Lookup.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAmE;AAEnE,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACvD,MAAa,MAAO,SAAQ,iBAAa;IACvC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC3B,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAClE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAE9D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;YAEzC,IACE,CAAC,CAAC,KAAK,YAAY,qBAAY,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAClE,CAAC,CAAC,KAAK,YAAY,mBAAU,CAAC;gBAE9B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAE1E,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;YAClC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnBD,wBAmBC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class Print extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Print = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ class Print extends __1.MacroFunction {
7
+ constructor(scope) {
8
+ super(scope, (...values) => {
9
+ return [null, [new instructions_1.InstructionBase("print", ...values)]];
10
+ });
11
+ }
12
+ }
13
+ exports.Print = Print;
14
+ //# sourceMappingURL=Print.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Print.js","sourceRoot":"","sources":["../../../src/macros/commands/Print.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAGnC,MAAa,KAAM,SAAQ,iBAAa;IACtC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,MAAgB,EAAE,EAAE;YACnC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAND,sBAMC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class PrintFlush extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrintFlush = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ class PrintFlush extends __1.MacroFunction {
8
+ constructor(scope) {
9
+ super(scope, (target) => {
10
+ if (!(target instanceof values_1.ObjectValue))
11
+ throw new Error("The printflush target must be a building");
12
+ return [null, [new instructions_1.InstructionBase("printflush", target)]];
13
+ });
14
+ }
15
+ }
16
+ exports.PrintFlush = PrintFlush;
17
+ //# sourceMappingURL=PrintFlush.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrintFlush.js","sourceRoot":"","sources":["../../../src/macros/commands/PrintFlush.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAuD;AAEvD,MAAa,UAAW,SAAQ,iBAAa;IAC3C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,MAAc,EAAE,EAAE;YAC9B,IAAI,CAAC,CAAC,MAAM,YAAY,oBAAW,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC9D,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AARD,gCAQC"}
@@ -0,0 +1,7 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare const validRadarFilters: string[];
4
+ export declare const validRadarSorts: string[];
5
+ export declare class Radar extends MacroFunction {
6
+ constructor(scope: IScope);
7
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Radar = exports.validRadarSorts = exports.validRadarFilters = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ const Namespace_1 = require("../Namespace");
8
+ exports.validRadarFilters = [
9
+ "any",
10
+ "enemy",
11
+ "ally",
12
+ "player",
13
+ "attacker",
14
+ "flying",
15
+ "boss",
16
+ "ground",
17
+ ];
18
+ exports.validRadarSorts = [
19
+ "distance",
20
+ "health",
21
+ "shield",
22
+ "armor",
23
+ "maxHealth",
24
+ ];
25
+ class Radar extends __1.MacroFunction {
26
+ constructor(scope) {
27
+ super(scope, (building, filter1, filter2, filter3, order, sort) => {
28
+ if (!(building instanceof values_1.ObjectValue))
29
+ throw new Error("The building must a store");
30
+ if (!(filter1 instanceof values_1.LiteralValue) ||
31
+ typeof filter1.data !== "string" ||
32
+ !(filter2 instanceof values_1.LiteralValue) ||
33
+ typeof filter2.data !== "string" ||
34
+ !(filter3 instanceof values_1.LiteralValue) ||
35
+ typeof filter3.data !== "string")
36
+ throw new Error("The filters must be string literals");
37
+ if (!exports.validRadarFilters.includes(filter1.data))
38
+ throw new Error("Invalid value for filter1");
39
+ if (!exports.validRadarFilters.includes(filter2.data))
40
+ throw new Error("Invalid value for filter2");
41
+ if (!exports.validRadarFilters.includes(filter3.data))
42
+ throw new Error("Invalid value for filter3");
43
+ if (!(order instanceof values_1.LiteralValue || order instanceof values_1.StoreValue))
44
+ throw new Error("The radar order must be a literal or a store");
45
+ if (!(sort instanceof values_1.LiteralValue) || typeof sort.data !== "string")
46
+ throw new Error("The radar sort must be a string literal");
47
+ if (!exports.validRadarSorts.includes(sort.data))
48
+ throw new Error("Invalid sort value");
49
+ const temp = new values_1.TempValue(scope);
50
+ const resultUnit = new Namespace_1.Unit(scope, temp.name);
51
+ return [
52
+ resultUnit,
53
+ [
54
+ new instructions_1.InstructionBase("radar", filter1.data, filter2.data, filter3.data, sort.data, building, order, temp),
55
+ ],
56
+ ];
57
+ });
58
+ }
59
+ }
60
+ exports.Radar = Radar;
61
+ //# sourceMappingURL=Radar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radar.js","sourceRoot":"","sources":["../../../src/macros/commands/Radar.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAgF;AAChF,4CAAoC;AAEvB,QAAA,iBAAiB,GAAG;IAC/B,KAAK;IACL,OAAO;IACP,MAAM;IACN,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,MAAM;IACN,QAAQ;CACT,CAAC;AAEW,QAAA,eAAe,GAAG;IAC7B,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,WAAW;CACZ,CAAC;AAEF,MAAa,KAAM,SAAQ,iBAAa;IACtC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAChE,IAAI,CAAC,CAAC,QAAQ,YAAY,oBAAW,CAAC;gBACpC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAE/C,IACE,CAAC,CAAC,OAAO,YAAY,qBAAY,CAAC;gBAClC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;gBAChC,CAAC,CAAC,OAAO,YAAY,qBAAY,CAAC;gBAClC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;gBAChC,CAAC,CAAC,OAAO,YAAY,qBAAY,CAAC;gBAClC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;gBAEhC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YAEzD,IAAI,CAAC,yBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC3C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC/C,IAAI,CAAC,yBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC3C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC/C,IAAI,CAAC,yBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC3C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAE/C,IAAI,CAAC,CAAC,KAAK,YAAY,qBAAY,IAAI,KAAK,YAAY,mBAAU,CAAC;gBACjE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;YAElE,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;gBAClE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAE7D,IAAI,CAAC,uBAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAExC,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;YAClC,MAAM,UAAU,GAAG,IAAI,gBAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9C,OAAO;gBACL,UAAU;gBACV;oBACE,IAAI,8BAAe,CACjB,OAAO,EACP,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,IAAI,EACZ,IAAI,CAAC,IAAI,EACT,QAAQ,EACR,KAAK,EACL,IAAI,CACL;iBACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnDD,sBAmDC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class Sensor extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sensor = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ class Sensor extends __1.MacroFunction {
8
+ constructor(scope) {
9
+ super(scope, (property, target) => {
10
+ if (!(property instanceof values_1.StoreValue))
11
+ throw new Error("The sensor property must be a store");
12
+ if (!(target instanceof values_1.ObjectValue))
13
+ throw new Error("The sensor target must be a store");
14
+ const temp = new values_1.TempValue(scope);
15
+ return [temp, [new instructions_1.InstructionBase("sensor", temp, property, target)]];
16
+ });
17
+ }
18
+ }
19
+ exports.Sensor = Sensor;
20
+ //# sourceMappingURL=Sensor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sensor.js","sourceRoot":"","sources":["../../../src/macros/commands/Sensor.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAkE;AAElE,MAAa,MAAO,SAAQ,iBAAa;IACvC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YAChC,IAAI,CAAC,CAAC,QAAQ,YAAY,mBAAU,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YAEzD,IAAI,CAAC,CAAC,MAAM,YAAY,oBAAW,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAEvD,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;YAClC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAbD,wBAaC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class UnitBind extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnitBind = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ class UnitBind extends __1.MacroFunction {
8
+ constructor(scope) {
9
+ super(scope, type => {
10
+ if (!(type instanceof values_1.StoreValue))
11
+ throw new Error("The unitBind type must be a store");
12
+ return [null, [new instructions_1.InstructionBase("ubind", type)]];
13
+ });
14
+ }
15
+ }
16
+ exports.UnitBind = UnitBind;
17
+ //# sourceMappingURL=UnitBind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnitBind.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitBind.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAqD;AAErD,MAAa,QAAS,SAAQ,iBAAa;IACzC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YAClB,IAAI,CAAC,CAAC,IAAI,YAAY,mBAAU,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAEvD,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AATD,4BASC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class UnitControl extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnitControl = void 0;
4
+ const instructions_1 = require("../../instructions");
5
+ const __1 = require("..");
6
+ const values_1 = require("../../values");
7
+ const Building_1 = require("../Building");
8
+ const validModes = [
9
+ "idle",
10
+ "stop",
11
+ "move",
12
+ "approach",
13
+ "boost",
14
+ "pathfind",
15
+ "target",
16
+ "targetp",
17
+ "itemDrop",
18
+ "itemTake",
19
+ "payDrop",
20
+ "payTake",
21
+ "payEnter",
22
+ "mine",
23
+ "flag",
24
+ "build",
25
+ "getBlock",
26
+ "within",
27
+ ];
28
+ class UnitControl extends __1.MacroFunction {
29
+ constructor(scope) {
30
+ super(scope, (mode, ...args) => {
31
+ if (!(mode instanceof values_1.LiteralValue) || typeof mode.data !== "string")
32
+ throw new Error("The unitControl mode must be a string literal");
33
+ if (!validModes.includes(mode.data))
34
+ throw new Error("Invalid unitControl mode");
35
+ if (args.some(value => !(value instanceof values_1.StoreValue ||
36
+ value instanceof values_1.LiteralValue ||
37
+ value instanceof values_1.ObjectValue)))
38
+ throw new Error("The others arguments of unitControl must be literals or stores");
39
+ let result = null;
40
+ let extraArgs = [];
41
+ switch (mode.data) {
42
+ case "getBlock": {
43
+ const outType = new values_1.TempValue(scope);
44
+ const outBuilding = new values_1.TempValue(scope);
45
+ result = new values_1.ObjectValue(scope, {
46
+ 0: outType,
47
+ 1: new Building_1.Building(scope, outBuilding.name),
48
+ length: new values_1.LiteralValue(scope, 2),
49
+ });
50
+ extraArgs = [outType, outBuilding, new values_1.LiteralValue(scope, 0)];
51
+ break;
52
+ }
53
+ case "within": {
54
+ const temp = new values_1.TempValue(scope);
55
+ result = temp;
56
+ extraArgs = [temp, 0];
57
+ break;
58
+ }
59
+ }
60
+ return [
61
+ result,
62
+ [new instructions_1.InstructionBase("ucontrol", mode.data, ...args, ...extraArgs)],
63
+ ];
64
+ });
65
+ }
66
+ }
67
+ exports.UnitControl = UnitControl;
68
+ //# sourceMappingURL=UnitControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnitControl.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitControl.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAgF;AAChF,0CAAuC;AAEvC,MAAM,UAAU,GAAG;IACjB,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;IACR,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;CACT,CAAC;AAEF,MAAa,WAAY,SAAQ,iBAAa;IAC5C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE;YAC7B,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;gBAClE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;YAEnE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAE9C,IACE,IAAI,CAAC,IAAI,CACP,KAAK,CAAC,EAAE,CACN,CAAC,CACC,KAAK,YAAY,mBAAU;gBAC3B,KAAK,YAAY,qBAAY;gBAC7B,KAAK,YAAY,oBAAW,CAC7B,CACJ;gBAED,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;YAEJ,IAAI,MAAM,GAAmC,IAAI,CAAC;YAClD,IAAI,SAAS,GAAG,EAAE,CAAC;YACnB,QAAQ,IAAI,CAAC,IAAI,EAAE;gBACjB,KAAK,UAAU,CAAC,CAAC;oBACf,MAAM,OAAO,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;oBACrC,MAAM,WAAW,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;oBACzC,MAAM,GAAG,IAAI,oBAAW,CAAC,KAAK,EAAE;wBAC9B,CAAC,EAAE,OAAO;wBACV,CAAC,EAAE,IAAI,mBAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC;wBACxC,MAAM,EAAE,IAAI,qBAAY,CAAC,KAAK,EAAE,CAAC,CAAC;qBACnC,CAAC,CAAC;oBACH,SAAS,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,qBAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;oBAC/D,MAAM;iBACP;gBACD,KAAK,QAAQ,CAAC,CAAC;oBACb,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,CAAC;oBAClC,MAAM,GAAG,IAAI,CAAC;oBACd,SAAS,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;oBACtB,MAAM;iBACP;aACF;YAED,OAAO;gBACL,MAAM;gBACN,CAAC,IAAI,8BAAe,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC;aACpE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnDD,kCAmDC"}
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class UnitLocate extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }