mlogjs 0.2.0 → 0.2.1

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 (202) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +68 -18
  3. package/build/Compiler.d.ts +18 -18
  4. package/build/Compiler.js +99 -119
  5. package/build/Compiler.js.map +1 -1
  6. package/build/Scope.d.ts +26 -26
  7. package/build/Scope.js +60 -60
  8. package/build/Scope.js.map +1 -1
  9. package/build/bin.d.ts +2 -2
  10. package/build/bin.js +60 -41
  11. package/build/bin.js.map +1 -1
  12. package/build/handlers/BlockStatement.d.ts +2 -2
  13. package/build/handlers/BlockStatement.js +13 -13
  14. package/build/handlers/CallExpression.d.ts +3 -3
  15. package/build/handlers/CallExpression.js +19 -19
  16. package/build/handlers/ForStatement.d.ts +2 -2
  17. package/build/handlers/ForStatement.js +31 -31
  18. package/build/handlers/Function.d.ts +4 -4
  19. package/build/handlers/Function.js +35 -35
  20. package/build/handlers/Identifier.d.ts +2 -2
  21. package/build/handlers/Identifier.js +7 -7
  22. package/build/handlers/IfStatement.d.ts +2 -2
  23. package/build/handlers/IfStatement.js +24 -24
  24. package/build/handlers/Literal.d.ts +2 -2
  25. package/build/handlers/Literal.js +17 -17
  26. package/build/handlers/Object.d.ts +4 -4
  27. package/build/handlers/Object.js +43 -43
  28. package/build/handlers/OperationExpressions.d.ts +7 -7
  29. package/build/handlers/OperationExpressions.js +32 -32
  30. package/build/handlers/Program.d.ts +2 -2
  31. package/build/handlers/Program.js +8 -8
  32. package/build/handlers/Program.js.map +1 -1
  33. package/build/handlers/Statements.d.ts +5 -5
  34. package/build/handlers/Statements.js +29 -29
  35. package/build/handlers/TemplateExpression.d.ts +2 -2
  36. package/build/handlers/TemplateExpression.js +17 -17
  37. package/build/handlers/VariableDeclaration.d.ts +3 -3
  38. package/build/handlers/VariableDeclaration.js +55 -55
  39. package/build/handlers/WhileStatement.d.ts +2 -2
  40. package/build/handlers/WhileStatement.js +22 -22
  41. package/build/handlers/index.d.ts +14 -14
  42. package/build/handlers/index.js +30 -30
  43. package/build/index.d.ts +1 -1
  44. package/build/index.js +7 -7
  45. package/build/initScope.d.ts +2 -0
  46. package/build/initScope.js +40 -0
  47. package/build/initScope.js.map +1 -0
  48. package/build/instructions/AddressResolver.d.ts +12 -12
  49. package/build/instructions/AddressResolver.js +30 -30
  50. package/build/instructions/ControlInstructions.d.ts +11 -11
  51. package/build/instructions/ControlInstructions.js +22 -22
  52. package/build/instructions/EndInstruction.d.ts +4 -4
  53. package/build/instructions/EndInstruction.js +10 -10
  54. package/build/instructions/InstructionBase.d.ts +10 -10
  55. package/build/instructions/InstructionBase.js +20 -20
  56. package/build/instructions/JumpInstruction.d.ts +15 -15
  57. package/build/instructions/JumpInstruction.js +21 -21
  58. package/build/instructions/OperationInstruction.d.ts +5 -5
  59. package/build/instructions/OperationInstruction.js +10 -10
  60. package/build/instructions/SetCounterInstruction.d.ts +5 -5
  61. package/build/instructions/SetCounterInstruction.js +10 -10
  62. package/build/instructions/SetInstruction.d.ts +5 -5
  63. package/build/instructions/SetInstruction.js +10 -10
  64. package/build/instructions/ZeroSpaceInstruction.d.ts +4 -4
  65. package/build/instructions/ZeroSpaceInstruction.js +10 -10
  66. package/build/instructions/index.d.ts +9 -9
  67. package/build/instructions/index.js +25 -25
  68. package/build/macros/Building.d.ts +11 -11
  69. package/build/macros/Building.js +80 -80
  70. package/build/macros/Function.d.ts +12 -12
  71. package/build/macros/Function.js +19 -19
  72. package/build/macros/Math.d.ts +5 -5
  73. package/build/macros/Math.js +56 -56
  74. package/build/macros/Math.js.map +1 -1
  75. package/build/macros/Memory.d.ts +5 -5
  76. package/build/macros/Memory.js +60 -60
  77. package/build/macros/Namespace.d.ts +21 -21
  78. package/build/macros/Namespace.js +97 -97
  79. package/build/macros/Other.d.ts +5 -5
  80. package/build/macros/Other.js +19 -19
  81. package/build/macros/RawValue.d.ts +5 -5
  82. package/build/macros/RawValue.js +15 -15
  83. package/build/macros/commands/{control.d.ts → Control.d.ts} +5 -5
  84. package/build/macros/commands/{control.js → Control.js} +24 -24
  85. package/build/macros/commands/{control.js.map → Control.js.map} +0 -0
  86. package/build/macros/commands/Draw.d.ts +5 -5
  87. package/build/macros/commands/Draw.js +38 -38
  88. package/build/macros/commands/DrawFlush.d.ts +5 -5
  89. package/build/macros/commands/DrawFlush.js +16 -16
  90. package/build/macros/commands/GetLink.d.ts +5 -5
  91. package/build/macros/commands/GetLink.js +20 -20
  92. package/build/macros/commands/Lookup.d.ts +5 -5
  93. package/build/macros/commands/Lookup.js +23 -23
  94. package/build/macros/commands/Print.d.ts +5 -5
  95. package/build/macros/commands/Print.js +13 -13
  96. package/build/macros/commands/PrintFlush.d.ts +5 -5
  97. package/build/macros/commands/PrintFlush.js +16 -16
  98. package/build/macros/commands/Radar.d.ts +7 -7
  99. package/build/macros/commands/Radar.js +60 -60
  100. package/build/macros/commands/Sensor.d.ts +5 -5
  101. package/build/macros/commands/Sensor.js +19 -19
  102. package/build/macros/commands/UnitBind.d.ts +5 -5
  103. package/build/macros/commands/UnitBind.js +16 -16
  104. package/build/macros/commands/UnitControl.d.ts +5 -5
  105. package/build/macros/commands/UnitControl.js +67 -67
  106. package/build/macros/commands/UnitLocate.d.ts +5 -5
  107. package/build/macros/commands/UnitLocate.js +54 -54
  108. package/build/macros/commands/UnitRadar.d.ts +5 -5
  109. package/build/macros/commands/UnitRadar.js +40 -40
  110. package/build/macros/commands/Wait.d.ts +5 -5
  111. package/build/macros/commands/Wait.js +17 -17
  112. package/build/macros/commands/index.d.ts +14 -14
  113. package/build/macros/commands/index.js +32 -32
  114. package/build/macros/index.d.ts +7 -7
  115. package/build/macros/index.js +39 -39
  116. package/build/operators.d.ts +25 -25
  117. package/build/operators.js +101 -101
  118. package/build/types.d.ts +49 -49
  119. package/build/types.js +27 -27
  120. package/build/utils.d.ts +3 -3
  121. package/build/utils.js +12 -12
  122. package/build/values/BaseValue.d.ts +5 -5
  123. package/build/values/BaseValue.js +111 -111
  124. package/build/values/FunctionValue.d.ts +34 -34
  125. package/build/values/FunctionValue.js +103 -103
  126. package/build/values/LiteralValue.d.ts +12 -12
  127. package/build/values/LiteralValue.js +87 -87
  128. package/build/values/LiteralValue.js.map +1 -1
  129. package/build/values/ObjectValue.d.ts +17 -17
  130. package/build/values/ObjectValue.js +49 -49
  131. package/build/values/StoreValue.d.ts +11 -11
  132. package/build/values/StoreValue.js +30 -30
  133. package/build/values/TempValue.d.ts +12 -12
  134. package/build/values/TempValue.js +66 -66
  135. package/build/values/TempValue.js.map +1 -1
  136. package/build/values/VoidValue.d.ts +11 -11
  137. package/build/values/VoidValue.js +30 -30
  138. package/build/values/index.d.ts +6 -6
  139. package/build/values/index.js +22 -22
  140. package/dist/mlogjs.es.js +6366 -0
  141. package/dist/mlogjs.umd.js +8 -0
  142. package/lib/commands.d.ts +326 -326
  143. package/lib/eslib/index.d.ts +3 -3
  144. package/lib/eslib/lib.d.ts +9 -9
  145. package/lib/eslib/lib.es2015.collection.d.ts +89 -89
  146. package/lib/eslib/lib.es2015.core.d.ts +16 -16
  147. package/lib/eslib/lib.es2015.d.ts +30 -30
  148. package/lib/eslib/lib.es2015.generator.d.ts +79 -79
  149. package/lib/eslib/lib.es2015.iterable.d.ts +70 -70
  150. package/lib/eslib/lib.es5.d.ts +295 -295
  151. package/lib/eslib/lib.es6.d.ts +18 -18
  152. package/lib/globals.d.ts +328 -328
  153. package/lib/helpers.d.ts +23 -23
  154. package/lib/index.d.ts +7 -7
  155. package/lib/kinds.d.ts +36 -36
  156. package/lib/memory.d.ts +17 -17
  157. package/lib/traits.d.ts +121 -121
  158. package/lib/util.d.ts +32 -32
  159. package/package.json +73 -48
  160. package/build/macros/Blocks.d.ts +0 -5
  161. package/build/macros/Blocks.js +0 -143
  162. package/build/macros/Blocks.js.map +0 -1
  163. package/build/macros/Draw.d.ts +0 -5
  164. package/build/macros/Draw.js +0 -39
  165. package/build/macros/Draw.js.map +0 -1
  166. package/build/macros/Items.d.ts +0 -5
  167. package/build/macros/Items.js +0 -20
  168. package/build/macros/Items.js.map +0 -1
  169. package/build/macros/Liquids.d.ts +0 -5
  170. package/build/macros/Liquids.js +0 -18
  171. package/build/macros/Liquids.js.map +0 -1
  172. package/build/macros/Symbol.d.ts +0 -0
  173. package/build/macros/Symbol.js +0 -1
  174. package/build/macros/Symbol.js.map +0 -1
  175. package/build/macros/SymbolNamespace.d.ts +0 -0
  176. package/build/macros/SymbolNamespace.js +0 -1
  177. package/build/macros/SymbolNamespace.js.map +0 -1
  178. package/build/macros/TypeFactory.d.ts +0 -8
  179. package/build/macros/TypeFactory.js +0 -22
  180. package/build/macros/TypeFactory.js.map +0 -1
  181. package/build/macros/Units.d.ts +0 -5
  182. package/build/macros/Units.js +0 -18
  183. package/build/macros/Units.js.map +0 -1
  184. package/build/macros/Vars.d.ts +0 -5
  185. package/build/macros/Vars.js +0 -18
  186. package/build/macros/Vars.js.map +0 -1
  187. package/build/macros/commands/Asm.d.ts +0 -5
  188. package/build/macros/commands/Asm.js +0 -21
  189. package/build/macros/commands/Asm.js.map +0 -1
  190. package/build/macros/commands/io.d.ts +0 -8
  191. package/build/macros/commands/io.js +0 -47
  192. package/build/macros/commands/io.js.map +0 -1
  193. package/build/macros/helpers/GetBuilding.d.ts +0 -5
  194. package/build/macros/helpers/GetBuilding.js +0 -16
  195. package/build/macros/helpers/GetBuilding.js.map +0 -1
  196. package/build/macros/helpers/GetVar.d.ts +0 -5
  197. package/build/macros/helpers/GetVar.js +0 -16
  198. package/build/macros/helpers/GetVar.js.map +0 -1
  199. package/build/macros/helpers/index.d.ts +0 -2
  200. package/build/macros/helpers/index.js +0 -15
  201. package/build/macros/helpers/index.js.map +0 -1
  202. package/dist/bundle.js +0 -1
package/lib/commands.d.ts CHANGED
@@ -1,326 +1,326 @@
1
- import "./kind";
2
- import { TRadarFilter, TRadarSort, TUnitLocateBuildingGroup } from "./util";
3
- declare global {
4
- /**
5
- * Appends the items to the print buffer, calling this function
6
- * on its own will not print any contents to a message block.
7
- *
8
- * To print the contents of the print buffer and empty it call `printFlush`.
9
- *
10
- * @param items The items to be added to the print buffer.
11
- */
12
- function print(...items: unknown[]): void;
13
-
14
- /**
15
- * Appends draw contents to the draw buffer.
16
- *
17
- * Warning: these methods only append data to the draw buffer,
18
- * which is used by `drawFlush` to actually draw content on a display.
19
- */
20
- function draw(mode: "clear", r: number, g: number, b: number): void;
21
-
22
- /**
23
- * Appends draw contents to the draw buffer.
24
- *
25
- * Warning: these methods only append data to the draw buffer,
26
- * which is used by `drawFlush` to actually draw content on a display.
27
- */
28
- function draw(
29
- mode: "color",
30
- r: number,
31
- g: number,
32
- b: number,
33
- a: number
34
- ): void;
35
-
36
- /**
37
- * Appends draw contents to the draw buffer.
38
- *
39
- * Warning: these methods only append data to the draw buffer,
40
- * which is used by `drawFlush` to actually draw content on a display.
41
- */
42
- function draw(mode: "stroke", width: number): void;
43
-
44
- /**
45
- * Appends draw contents to the draw buffer.
46
- *
47
- * Warning: these methods only append data to the draw buffer,
48
- * which is used by `drawFlush` to actually draw content on a display.
49
- */
50
- function draw(
51
- mode: "line",
52
- x1: number,
53
- y1: number,
54
- x2: number,
55
- y2: number
56
- ): void;
57
-
58
- /**
59
- * Appends draw contents to the draw buffer.
60
- *
61
- * Warning: these methods only append data to the draw buffer,
62
- * which is used by `drawFlush` to actually draw content on a display.
63
- */
64
- function draw(
65
- mode: "rect",
66
- x: number,
67
- y: number,
68
- width: number,
69
- height: number
70
- ): void;
71
-
72
- /**
73
- * Appends draw contents to the draw buffer.
74
- *
75
- * Warning: these methods only append data to the draw buffer,
76
- * which is used by `drawFlush` to actually draw content on a display.
77
- */
78
- function draw(
79
- mode: "lineRect",
80
- x: number,
81
- y: number,
82
- width: number,
83
- height: number
84
- ): void;
85
-
86
- /**
87
- * Appends draw contents to the draw buffer.
88
- *
89
- * Warning: these methods only append data to the draw buffer,
90
- * which is used by `drawFlush` to actually draw content on a display.
91
- */
92
- function draw(
93
- mode: "poly",
94
- x: number,
95
- y: number,
96
- sides: number,
97
- radius: number,
98
- rotation: number
99
- ): void;
100
-
101
- /**
102
- * Appends draw contents to the draw buffer.
103
- *
104
- * Warning: these methods only append data to the draw buffer,
105
- * which is used by `drawFlush` to actually draw content on a display.
106
- */
107
- function draw(
108
- mode: "linePoly",
109
- x: number,
110
- y: number,
111
- sides: number,
112
- radius: number,
113
- rotation: number
114
- ): void;
115
-
116
- /**
117
- * Appends draw contents to the draw buffer.
118
- *
119
- * Warning: these methods only append data to the draw buffer,
120
- * which is used by `drawFlush` to actually draw content on a display.
121
- */
122
- function draw(
123
- mode: "triangle",
124
- x: number,
125
- y: number,
126
- x2: number,
127
- y2: number,
128
- x3: number,
129
- y3: number
130
- ): void;
131
-
132
- /**
133
- * Appends draw contents to the draw buffer.
134
- *
135
- * Warning: these methods only append data to the draw buffer,
136
- * which is used by `drawFlush` to actually draw content on a display.
137
- */
138
- function draw(
139
- mode: "image",
140
- x: number,
141
- y: number,
142
- image: symbol,
143
- size: number,
144
- rotation: number
145
- ): void;
146
-
147
- /**
148
- * Writes the contents of the print buffer into the target message
149
- * and clears the buffer afterwards.
150
- * @param target
151
- */
152
- function printFlush(target: BasicBuilding): void;
153
-
154
- /**
155
- * Writes the contents of the draw buffer into the target display
156
- * and clears the buffer afterwards.
157
- * @param target
158
- */
159
- function drawFlush(target: BasicBuilding): void;
160
-
161
- /**
162
- * Gets a block link by its index.
163
- * @param index
164
- */
165
- function getLink<T extends BasicBuilding = AnyBuilding>(index: number): T;
166
-
167
- function control(
168
- kind: "enabled",
169
- building: BasicBuilding,
170
- value: boolean
171
- ): void;
172
-
173
- function control(
174
- kind: "shoot",
175
- building: BasicBuilding & Shooting,
176
- x: number,
177
- y: number,
178
- shoot: boolean
179
- ): void;
180
-
181
- function control(
182
- kind: "shootp",
183
- building: BasicBuilding & Shooting,
184
- unit: BasicUnit,
185
- shoot: boolean
186
- ): void;
187
-
188
- function control(
189
- kind: "config",
190
- building: BasicBuilding,
191
- value: symbol
192
- ): void;
193
-
194
- function control(
195
- kind: "color",
196
- building: BasicBuilding,
197
- r: number,
198
- g: number,
199
- b: number
200
- ): void;
201
-
202
- /**
203
- * Detects an unit nearby this `building`.
204
- * @param building The building used to detect potential targets
205
- * @param filter1 First filter for selecting a target. Setting it to "any" ignores it
206
- * @param filter2 Second filter for selecting a target. Setting it to "any" ignores it
207
- * @param filter3 Third filter for selecting a target. Setting it to "any" ignores it
208
- * @param order The n th unit that fits these requirements based on the sorting method
209
- * (1 => first unit, 2 => second unit and so on)
210
- * @param sort The method on which the results should be sorted
211
- *
212
- * @example
213
- * const turret = getBuilding("cyclone1")
214
- * // returns the second nearest enemy unit
215
- * const result = radar(turret, "enemy", "any", "any", 2, "distance")
216
- */
217
- function radar<T extends BasicUnit = AnyUnit>(
218
- building: BasicBuilding,
219
- filter1: TRadarFilter,
220
- filter2: TRadarFilter,
221
- filter3: TRadarFilter,
222
- order: number,
223
- sort: TRadarSort
224
- ): T;
225
-
226
- /**
227
- * Alternate way to access special properties on objects.
228
- *
229
- * This method allows you to use customly created symbols
230
- * and sensor them on buildings.
231
- * @param property The property to be sensed on the building
232
- * @param target
233
- *
234
- * @example
235
- * let myBuilding = getBuilding("container1")
236
- * // jsdoc doesn't allow me to type this
237
- * // variable, but you should type it as a symbol in this case
238
- * let myCustomSymbol = getVar("@custom-symbol") // problably defined by a mod
239
- * let result = sensor(myCustomSymbol, myBuilding)
240
- */
241
- function sensor<T>(property: symbol, target: BasicBuilding | BasicUnit): T;
242
-
243
- function wait(seconds: number): void;
244
-
245
- function lookup(kind: "block", index: number): BlockSymbol | null;
246
- function lookup(kind: "unit", index: number): UnitSymbol | null;
247
- function lookup(kind: "item", index: number): ItemSymbol | null;
248
- function lookup(kind: "liquid", index: number): LiquidSymbol | null;
249
-
250
- function unitBind(type: UnitSymbol): void;
251
-
252
- function unitControl(mode: "idle"): void;
253
- function unitControl(mode: "stop"): void;
254
- function unitControl(mode: "move", x: number, y: number): void;
255
- function unitControl(
256
- mode: "approach",
257
- x: number,
258
- y: number,
259
- radius: number
260
- ): void;
261
- function unitControl(mode: "boost", enable: boolean): void;
262
- function unitControl(mode: "pathfind"): void;
263
- function unitControl(
264
- mode: "target",
265
- x: number,
266
- y: number,
267
- shoot: boolean
268
- ): void;
269
- function unitControl(mode: "targetp", unit: BasicUnit, shoot: boolean): void;
270
- function unitControl(
271
- mode: "itemDrop",
272
- target: BasicBuilding | typeof Blocks.air,
273
- amount: number
274
- ): void;
275
- function unitControl(
276
- mode: "itemTake",
277
- target: BasicBuilding,
278
- item: ItemSymbol,
279
- amount: number
280
- ): void;
281
- function unitControl(mode: "payDrop"): void;
282
- function unitControl(mode: "payTake", takeUnits: boolean): void;
283
- function unitControl(mode: "payEnter"): void;
284
- function unitControl(mode: "mine", x: number, y: number): void;
285
- function unitControl(mode: "flag", value: number): void;
286
- function unitControl(
287
- mode: "build",
288
- x: number,
289
- y: number,
290
- block: BlockSymbol,
291
- rotation: number,
292
- config: unknown
293
- ): void;
294
- function unitControl<T extends BasicBuilding = AnyBuilding>(
295
- mode: "getBlock",
296
- x: number,
297
- y: number
298
- ): [type: BlockSymbol | null, building: T | null];
299
- function unitControl(
300
- mode: "within",
301
- x: number,
302
- y: number,
303
- radius: number
304
- ): boolean;
305
-
306
- function unitRadar<T extends BasicUnit>(
307
- filter1: TRadarFilter,
308
- filter2: TRadarFilter,
309
- filter3: TRadarFilter,
310
- order: number,
311
- sort: TRadarSort
312
- ): T;
313
-
314
- function unitLocate(
315
- find: "ore",
316
- ore: ItemSymbol
317
- ): [found: false] | [found: true, x: number, y: number];
318
- function unitLocate<T extends BasicBuilding = AnyBuilding>(
319
- find: "building",
320
- group: TUnitLocateBuildingGroup,
321
- enemy: boolean
322
- ): [found: false] | [found: true, x: number, y: number, building: T];
323
- function unitLocate<T extends BasicBuilding = AnyBuilding>(
324
- find: "spawn" | "damaged"
325
- ): [found: false] | [found: true, x: number, y: number, building: T];
326
- }
1
+ import "./kind";
2
+ import { TRadarFilter, TRadarSort, TUnitLocateBuildingGroup } from "./util";
3
+ declare global {
4
+ /**
5
+ * Appends the items to the print buffer, calling this function
6
+ * on its own will not print any contents to a message block.
7
+ *
8
+ * To print the contents of the print buffer and empty it call `printFlush`.
9
+ *
10
+ * @param items The items to be added to the print buffer.
11
+ */
12
+ function print(...items: unknown[]): void;
13
+
14
+ /**
15
+ * Appends draw contents to the draw buffer.
16
+ *
17
+ * Warning: these methods only append data to the draw buffer,
18
+ * which is used by `drawFlush` to actually draw content on a display.
19
+ */
20
+ function draw(mode: "clear", r: number, g: number, b: number): void;
21
+
22
+ /**
23
+ * Appends draw contents to the draw buffer.
24
+ *
25
+ * Warning: these methods only append data to the draw buffer,
26
+ * which is used by `drawFlush` to actually draw content on a display.
27
+ */
28
+ function draw(
29
+ mode: "color",
30
+ r: number,
31
+ g: number,
32
+ b: number,
33
+ a: number
34
+ ): void;
35
+
36
+ /**
37
+ * Appends draw contents to the draw buffer.
38
+ *
39
+ * Warning: these methods only append data to the draw buffer,
40
+ * which is used by `drawFlush` to actually draw content on a display.
41
+ */
42
+ function draw(mode: "stroke", width: number): void;
43
+
44
+ /**
45
+ * Appends draw contents to the draw buffer.
46
+ *
47
+ * Warning: these methods only append data to the draw buffer,
48
+ * which is used by `drawFlush` to actually draw content on a display.
49
+ */
50
+ function draw(
51
+ mode: "line",
52
+ x1: number,
53
+ y1: number,
54
+ x2: number,
55
+ y2: number
56
+ ): void;
57
+
58
+ /**
59
+ * Appends draw contents to the draw buffer.
60
+ *
61
+ * Warning: these methods only append data to the draw buffer,
62
+ * which is used by `drawFlush` to actually draw content on a display.
63
+ */
64
+ function draw(
65
+ mode: "rect",
66
+ x: number,
67
+ y: number,
68
+ width: number,
69
+ height: number
70
+ ): void;
71
+
72
+ /**
73
+ * Appends draw contents to the draw buffer.
74
+ *
75
+ * Warning: these methods only append data to the draw buffer,
76
+ * which is used by `drawFlush` to actually draw content on a display.
77
+ */
78
+ function draw(
79
+ mode: "lineRect",
80
+ x: number,
81
+ y: number,
82
+ width: number,
83
+ height: number
84
+ ): void;
85
+
86
+ /**
87
+ * Appends draw contents to the draw buffer.
88
+ *
89
+ * Warning: these methods only append data to the draw buffer,
90
+ * which is used by `drawFlush` to actually draw content on a display.
91
+ */
92
+ function draw(
93
+ mode: "poly",
94
+ x: number,
95
+ y: number,
96
+ sides: number,
97
+ radius: number,
98
+ rotation: number
99
+ ): void;
100
+
101
+ /**
102
+ * Appends draw contents to the draw buffer.
103
+ *
104
+ * Warning: these methods only append data to the draw buffer,
105
+ * which is used by `drawFlush` to actually draw content on a display.
106
+ */
107
+ function draw(
108
+ mode: "linePoly",
109
+ x: number,
110
+ y: number,
111
+ sides: number,
112
+ radius: number,
113
+ rotation: number
114
+ ): void;
115
+
116
+ /**
117
+ * Appends draw contents to the draw buffer.
118
+ *
119
+ * Warning: these methods only append data to the draw buffer,
120
+ * which is used by `drawFlush` to actually draw content on a display.
121
+ */
122
+ function draw(
123
+ mode: "triangle",
124
+ x: number,
125
+ y: number,
126
+ x2: number,
127
+ y2: number,
128
+ x3: number,
129
+ y3: number
130
+ ): void;
131
+
132
+ /**
133
+ * Appends draw contents to the draw buffer.
134
+ *
135
+ * Warning: these methods only append data to the draw buffer,
136
+ * which is used by `drawFlush` to actually draw content on a display.
137
+ */
138
+ function draw(
139
+ mode: "image",
140
+ x: number,
141
+ y: number,
142
+ image: symbol,
143
+ size: number,
144
+ rotation: number
145
+ ): void;
146
+
147
+ /**
148
+ * Writes the contents of the print buffer into the target message
149
+ * and clears the buffer afterwards.
150
+ * @param target
151
+ */
152
+ function printFlush(target: BasicBuilding): void;
153
+
154
+ /**
155
+ * Writes the contents of the draw buffer into the target display
156
+ * and clears the buffer afterwards.
157
+ * @param target
158
+ */
159
+ function drawFlush(target: BasicBuilding): void;
160
+
161
+ /**
162
+ * Gets a block link by its index.
163
+ * @param index
164
+ */
165
+ function getLink<T extends BasicBuilding = AnyBuilding>(index: number): T;
166
+
167
+ function control(
168
+ kind: "enabled",
169
+ building: BasicBuilding,
170
+ value: boolean
171
+ ): void;
172
+
173
+ function control(
174
+ kind: "shoot",
175
+ building: BasicBuilding & Shooting,
176
+ x: number,
177
+ y: number,
178
+ shoot: boolean
179
+ ): void;
180
+
181
+ function control(
182
+ kind: "shootp",
183
+ building: BasicBuilding & Shooting,
184
+ unit: BasicUnit,
185
+ shoot: boolean
186
+ ): void;
187
+
188
+ function control(
189
+ kind: "config",
190
+ building: BasicBuilding,
191
+ value: symbol
192
+ ): void;
193
+
194
+ function control(
195
+ kind: "color",
196
+ building: BasicBuilding,
197
+ r: number,
198
+ g: number,
199
+ b: number
200
+ ): void;
201
+
202
+ /**
203
+ * Detects an unit nearby this `building`.
204
+ * @param building The building used to detect potential targets
205
+ * @param filter1 First filter for selecting a target. Setting it to "any" ignores it
206
+ * @param filter2 Second filter for selecting a target. Setting it to "any" ignores it
207
+ * @param filter3 Third filter for selecting a target. Setting it to "any" ignores it
208
+ * @param order The n th unit that fits these requirements based on the sorting method
209
+ * (1 => first unit, 2 => second unit and so on)
210
+ * @param sort The method on which the results should be sorted
211
+ *
212
+ * @example
213
+ * const turret = getBuilding("cyclone1")
214
+ * // returns the second nearest enemy unit
215
+ * const result = radar(turret, "enemy", "any", "any", 2, "distance")
216
+ */
217
+ function radar<T extends BasicUnit = AnyUnit>(
218
+ building: BasicBuilding,
219
+ filter1: TRadarFilter,
220
+ filter2: TRadarFilter,
221
+ filter3: TRadarFilter,
222
+ order: number,
223
+ sort: TRadarSort
224
+ ): T;
225
+
226
+ /**
227
+ * Alternate way to access special properties on objects.
228
+ *
229
+ * This method allows you to use customly created symbols
230
+ * and sensor them on buildings.
231
+ * @param property The property to be sensed on the building
232
+ * @param target
233
+ *
234
+ * @example
235
+ * let myBuilding = getBuilding("container1")
236
+ * // jsdoc doesn't allow me to type this
237
+ * // variable, but you should type it as a symbol in this case
238
+ * let myCustomSymbol = getVar("@custom-symbol") // problably defined by a mod
239
+ * let result = sensor(myCustomSymbol, myBuilding)
240
+ */
241
+ function sensor<T>(property: symbol, target: BasicBuilding | BasicUnit): T;
242
+
243
+ function wait(seconds: number): void;
244
+
245
+ function lookup(kind: "block", index: number): BlockSymbol | null;
246
+ function lookup(kind: "unit", index: number): UnitSymbol | null;
247
+ function lookup(kind: "item", index: number): ItemSymbol | null;
248
+ function lookup(kind: "liquid", index: number): LiquidSymbol | null;
249
+
250
+ function unitBind(type: UnitSymbol): void;
251
+
252
+ function unitControl(mode: "idle"): void;
253
+ function unitControl(mode: "stop"): void;
254
+ function unitControl(mode: "move", x: number, y: number): void;
255
+ function unitControl(
256
+ mode: "approach",
257
+ x: number,
258
+ y: number,
259
+ radius: number
260
+ ): void;
261
+ function unitControl(mode: "boost", enable: boolean): void;
262
+ function unitControl(mode: "pathfind"): void;
263
+ function unitControl(
264
+ mode: "target",
265
+ x: number,
266
+ y: number,
267
+ shoot: boolean
268
+ ): void;
269
+ function unitControl(mode: "targetp", unit: BasicUnit, shoot: boolean): void;
270
+ function unitControl(
271
+ mode: "itemDrop",
272
+ target: BasicBuilding | typeof Blocks.air,
273
+ amount: number
274
+ ): void;
275
+ function unitControl(
276
+ mode: "itemTake",
277
+ target: BasicBuilding,
278
+ item: ItemSymbol,
279
+ amount: number
280
+ ): void;
281
+ function unitControl(mode: "payDrop"): void;
282
+ function unitControl(mode: "payTake", takeUnits: boolean): void;
283
+ function unitControl(mode: "payEnter"): void;
284
+ function unitControl(mode: "mine", x: number, y: number): void;
285
+ function unitControl(mode: "flag", value: number): void;
286
+ function unitControl(
287
+ mode: "build",
288
+ x: number,
289
+ y: number,
290
+ block: BlockSymbol,
291
+ rotation: number,
292
+ config: unknown
293
+ ): void;
294
+ function unitControl<T extends BasicBuilding = AnyBuilding>(
295
+ mode: "getBlock",
296
+ x: number,
297
+ y: number
298
+ ): [type: BlockSymbol | null, building: T | null];
299
+ function unitControl(
300
+ mode: "within",
301
+ x: number,
302
+ y: number,
303
+ radius: number
304
+ ): boolean;
305
+
306
+ function unitRadar<T extends BasicUnit>(
307
+ filter1: TRadarFilter,
308
+ filter2: TRadarFilter,
309
+ filter3: TRadarFilter,
310
+ order: number,
311
+ sort: TRadarSort
312
+ ): T;
313
+
314
+ function unitLocate(
315
+ find: "ore",
316
+ ore: ItemSymbol
317
+ ): [found: false] | [found: true, x: number, y: number];
318
+ function unitLocate<T extends BasicBuilding = AnyBuilding>(
319
+ find: "building",
320
+ group: TUnitLocateBuildingGroup,
321
+ enemy: boolean
322
+ ): [found: false] | [found: true, x: number, y: number, building: T];
323
+ function unitLocate<T extends BasicBuilding = AnyBuilding>(
324
+ find: "spawn" | "damaged"
325
+ ): [found: false] | [found: true, x: number, y: number, building: T];
326
+ }
@@ -1,3 +1,3 @@
1
- /// <reference no-default-lib="true"/>
2
-
3
- /// <reference lib="es2015" />
1
+ /// <reference no-default-lib="true"/>
2
+
3
+ /// <reference lib="es2015" />
@@ -1,9 +1,9 @@
1
- /*! *****************************************************************************
2
- All files in this folder are dryed up versions of the original ones.
3
-
4
- This makes updates more manageable.
5
- ***************************************************************************** */
6
-
7
- /// <reference no-default-lib="true"/>
8
-
9
- /// <reference lib="es5" />
1
+ /*! *****************************************************************************
2
+ All files in this folder are dryed up versions of the original ones.
3
+
4
+ This makes updates more manageable.
5
+ ***************************************************************************** */
6
+
7
+ /// <reference no-default-lib="true"/>
8
+
9
+ /// <reference lib="es5" />