mlogjs 0.5.2 → 0.6.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 (79) hide show
  1. package/README.md +2 -2
  2. package/dist/{index.cjs → Compiler-7GMG4MDr.js} +1746 -452
  3. package/dist/Compiler.d.ts +8 -12
  4. package/dist/CompilerError.d.ts +13 -3
  5. package/dist/Scope.d.ts +8 -8
  6. package/dist/bin/files.d.ts +18 -0
  7. package/dist/bin.mjs +170 -0
  8. package/dist/handlers/Import.d.ts +5 -0
  9. package/dist/handlers/Literal.d.ts +2 -2
  10. package/dist/handlers/Typescript.d.ts +2 -2
  11. package/dist/handlers/index.d.ts +1 -0
  12. package/dist/index.mjs +3 -4267
  13. package/dist/instructions/AddressResolver.d.ts +4 -4
  14. package/dist/instructions/ControlInstructions.d.ts +3 -3
  15. package/dist/instructions/InstructionBase.d.ts +1 -0
  16. package/dist/instructions/JumpInstruction.d.ts +5 -5
  17. package/dist/instructions/index.d.ts +0 -1
  18. package/dist/macros/DynamicArray.d.ts +4 -4
  19. package/dist/macros/Function.d.ts +2 -2
  20. package/dist/macros/GetBuildings.d.ts +4 -0
  21. package/dist/macros/GetColor.d.ts +4 -0
  22. package/dist/macros/Marker.d.ts +4 -0
  23. package/dist/macros/Namespace.d.ts +16 -0
  24. package/dist/macros/Queries.d.ts +10 -0
  25. package/dist/macros/StringView.d.ts +4 -0
  26. package/dist/macros/commands/Effect.d.ts +4 -0
  27. package/dist/macros/commands/Format.d.ts +4 -0
  28. package/dist/macros/commands/LocalePrint.d.ts +4 -0
  29. package/dist/macros/commands/PlayMusic.d.ts +4 -0
  30. package/dist/macros/commands/PlaySound.d.ts +4 -0
  31. package/dist/macros/commands/PrintChar.d.ts +4 -0
  32. package/dist/macros/commands/Query.d.ts +4 -0
  33. package/dist/macros/commands/SetProp.d.ts +4 -0
  34. package/dist/macros/commands/SpawnBullet.d.ts +4 -0
  35. package/dist/macros/commands/Sync.d.ts +6 -0
  36. package/dist/macros/commands/UnpackColor.d.ts +4 -0
  37. package/dist/macros/commands/WeatherSense.d.ts +4 -0
  38. package/dist/macros/commands/WeatherSet.d.ts +4 -0
  39. package/dist/macros/commands/index.d.ts +13 -0
  40. package/dist/macros/index.d.ts +7 -1
  41. package/dist/macros/util.d.ts +5 -2
  42. package/dist/modules.d.ts +8 -0
  43. package/dist/operators.d.ts +1 -1
  44. package/dist/types.d.ts +84 -59
  45. package/dist/utils/constants.d.ts +9 -4
  46. package/dist/utils/general.d.ts +8 -9
  47. package/dist/utils/instruction.d.ts +5 -1
  48. package/dist/utils/value.d.ts +14 -5
  49. package/dist/values/AssignmentValue.d.ts +1 -1
  50. package/dist/values/BaseValue.d.ts +4 -2
  51. package/dist/values/DestructuringValue.d.ts +5 -7
  52. package/dist/values/FunctionValue.d.ts +8 -6
  53. package/dist/values/JumpOutValue.d.ts +4 -4
  54. package/dist/values/LazyValue.d.ts +3 -3
  55. package/dist/values/LiteralValue.d.ts +2 -3
  56. package/dist/values/ObjectValue.d.ts +6 -11
  57. package/dist/values/StoreValue.d.ts +10 -5
  58. package/dist/values/VoidValue.d.ts +2 -1
  59. package/dist/values/index.d.ts +0 -1
  60. package/lib/commands.d.ts +776 -730
  61. package/lib/eslib/lib.es2015.collection.d.ts +50 -39
  62. package/lib/eslib/lib.es2015.core.d.ts +59 -0
  63. package/lib/eslib/lib.es2015.d.ts +0 -3
  64. package/lib/eslib/lib.es2015.generator.d.ts +54 -53
  65. package/lib/eslib/lib.es2015.iterable.d.ts +9 -6
  66. package/lib/eslib/lib.es5.d.ts +53 -6
  67. package/lib/globals.d.ts +309 -18
  68. package/lib/helpers.d.ts +86 -52
  69. package/lib/kinds.d.ts +42 -7
  70. package/lib/macros.d.ts +53 -18
  71. package/lib/traits.d.ts +308 -146
  72. package/lib/util.d.ts +144 -48
  73. package/lib/world.d.ts +1197 -0
  74. package/package.json +27 -35
  75. package/dist/bin.cjs +0 -111
  76. package/dist/initScope.d.ts +0 -5
  77. package/dist/instructions/ZeroSpaceInstruction.d.ts +0 -4
  78. package/dist/values/SenseableValue.d.ts +0 -24
  79. /package/dist/{bin.d.ts → bin/index.d.ts} +0 -0
package/lib/globals.d.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  declare enum ControlKind {
4
4
  ctrlPlayer,
5
5
  ctrlProcessor,
6
+ ctrlCommand,
7
+ /** @deprecated Replaced by ctrlCommand in Mindustry v7 */
6
8
  ctrlFormation,
7
9
  }
8
10
 
@@ -28,22 +30,22 @@ interface Vars {
28
30
  readonly ipt: number;
29
31
  /** The unit bound to this processor */
30
32
  readonly unit: AnyUnit;
31
- /** The amount of ticks that happened since the map started*/
33
+ /** The amount of ticks that happened since the map started */
32
34
  readonly tick: number;
33
- /** The current UNIX timestamp in milliseconds */
35
+ /** The amount of milliseconds that passed since the map started */
34
36
  readonly time: number;
35
37
  /**
36
38
  * The amount of seconds that passed since the map started.
37
39
  *
38
- * This number is NOT an integer, use `Math.floor` to get the number
39
- * of whole seconds that already passed.
40
+ * This number is NOT an integer, use `Math.floor` to get the number of whole
41
+ * seconds that already passed.
40
42
  */
41
43
  readonly second: number;
42
44
  /**
43
45
  * The amount of minutes that passed since the map started.
44
46
  *
45
- * This number is NOT an integer, use `Math.floor` to get the number
46
- * of whole minutes that already passed.
47
+ * This number is NOT an integer, use `Math.floor` to get the number of whole
48
+ * minutes that already passed.
47
49
  */
48
50
  readonly minute: number;
49
51
  /** The number of the current wave. Starts at 1. */
@@ -51,22 +53,34 @@ interface Vars {
51
53
  /**
52
54
  * The amount of seconds left before the next wave.
53
55
  *
54
- * This number is NOT an integer, use `Math.floor` to get the number
55
- * of whole seconds left.
56
+ * This number is NOT an integer, use `Math.floor` to get the number of whole
57
+ * seconds left.
56
58
  */
57
59
  readonly waveTime: number;
58
- /** Total amount of items existent, can be used to check if an ID is valid*/
60
+ /** Total amount of items existent, can be used to check if an ID is valid */
59
61
  readonly itemCount: number;
60
- /** Total amount of liquids existent, can be used to check if an ID is valid*/
62
+ /** Total amount of liquids existent, can be used to check if an ID is valid */
61
63
  readonly liquidCount: number;
62
- /** Total amount of units existent, can be used to check if an ID is valid*/
64
+ /** Total amount of units existent, can be used to check if an ID is valid */
63
65
  readonly unitCount: number;
64
- /** Total amount of blocks existent, can be used to check if an ID is valid*/
66
+ /** Total amount of blocks existent, can be used to check if an ID is valid */
65
67
  readonly blockCount: number;
66
68
  }
67
69
 
68
70
  declare const Vars: Vars;
69
71
 
72
+ declare enum Align {
73
+ left,
74
+ center,
75
+ right,
76
+ topLeft,
77
+ top,
78
+ topRight,
79
+ bottomLeft,
80
+ bottom,
81
+ bottomRight,
82
+ }
83
+
70
84
  /** Contains the base game teams. */
71
85
  declare namespace Teams {
72
86
  /** The gray team. */
@@ -92,6 +106,7 @@ declare namespace Teams {
92
106
  }
93
107
 
94
108
  type TeamSymbol = (typeof Teams)[keyof typeof Teams];
109
+ type TeamIdentifier = TeamSymbol | number;
95
110
 
96
111
  declare namespace Items {
97
112
  const copper: unique symbol;
@@ -198,6 +213,8 @@ declare namespace Units {
198
213
  const block: unique symbol;
199
214
  const manifold: unique symbol;
200
215
  const assemblyDrone: unique symbol;
216
+ const dummy: unique symbol;
217
+ const missile: unique symbol;
201
218
  }
202
219
 
203
220
  type UnitSymbol = (typeof Units)[keyof typeof Units];
@@ -216,18 +233,49 @@ declare namespace LAccess {
216
233
  const powerNetOut: unique symbol;
217
234
  const ammo: unique symbol;
218
235
  const ammoCapacity: unique symbol;
236
+ const currentAmmoType: unique symbol;
237
+ const memoryCapacity: unique symbol;
219
238
  const health: unique symbol;
220
239
  const maxHealth: unique symbol;
221
240
  const heat: unique symbol;
241
+ const shield: unique symbol;
242
+ const armor: unique symbol;
222
243
  const efficiency: unique symbol;
223
244
  const progress: unique symbol;
224
245
  const timescale: unique symbol;
225
246
  const rotation: unique symbol;
226
247
  const x: unique symbol;
227
248
  const y: unique symbol;
249
+ const velocityX: unique symbol;
250
+ const velocityY: unique symbol;
228
251
  const shootX: unique symbol;
229
252
  const shootY: unique symbol;
253
+ /**
254
+ * Senses the X coordinate of the player camera. Privileged (world) processors
255
+ * only; evaluates to null on standard processors.
256
+ */
257
+ const cameraX: unique symbol;
258
+ /**
259
+ * Senses the Y coordinate of the player camera. Privileged (world) processors
260
+ * only; evaluates to null on standard processors.
261
+ */
262
+ const cameraY: unique symbol;
263
+ /**
264
+ * Senses the viewport width of the player camera. Privileged (world)
265
+ * processors only; evaluates to null on standard processors.
266
+ */
267
+ const cameraWidth: unique symbol;
268
+ /**
269
+ * Senses the viewport height of the player camera. Privileged (world)
270
+ * processors only; evaluates to null on standard processors.
271
+ */
272
+ const cameraHeight: unique symbol;
273
+ const displayWidth: unique symbol;
274
+ const displayHeight: unique symbol;
275
+ const bufferSize: unique symbol;
276
+ const operations: unique symbol;
230
277
  const size: unique symbol;
278
+ const solid: unique symbol;
231
279
  const dead: unique symbol;
232
280
  const range: unique symbol;
233
281
  const shooting: unique symbol;
@@ -235,20 +283,207 @@ declare namespace LAccess {
235
283
  const mineX: unique symbol;
236
284
  const mineY: unique symbol;
237
285
  const mining: unique symbol;
286
+ const buildX: unique symbol;
287
+ const buildY: unique symbol;
288
+ const building: unique symbol;
289
+ const breaking: unique symbol;
238
290
  const speed: unique symbol;
239
291
  const team: unique symbol;
240
292
  const type: unique symbol;
241
293
  const flag: unique symbol;
294
+ const flying: unique symbol;
242
295
  const controlled: unique symbol;
243
296
  const controller: unique symbol;
244
297
  const name: unique symbol;
245
298
  const payloadCount: unique symbol;
246
299
  const payloadType: unique symbol;
300
+ const totalPayload: unique symbol;
301
+ const payloadCapacity: unique symbol;
302
+ const maxUnits: unique symbol;
303
+ const id: unique symbol;
304
+ const pingX: unique symbol;
305
+ const pingY: unique symbol;
306
+ const pingText: unique symbol;
307
+ const selectedBlock: unique symbol;
308
+ const selectedRotation: unique symbol;
309
+ const bulletLifetime: unique symbol;
310
+ const bulletTime: unique symbol;
247
311
  const enabled: unique symbol;
248
312
  const config: unique symbol;
313
+ /**
314
+ * Senses, in:
315
+ *
316
+ * - Illuminators: the illuminator's light color.
317
+ * - Buildings: the buildings's team's color.
318
+ * - Units: the unit's team's color.
319
+ * - Block symbols: the block's map color.
320
+ * - Item symbols: the item's color.
321
+ * - Liquid symbols: the liquid's color.
322
+ */
249
323
  const color: unique symbol;
250
324
  }
251
325
 
326
+ /** Contains the built-in game colors. */
327
+ declare namespace Colors {
328
+ const tan: number;
329
+ const sky: number;
330
+ const pink: number;
331
+ const lightgrey: number;
332
+ const white: number;
333
+ const lightgray: number;
334
+ const magenta: number;
335
+ const salmon: number;
336
+ const coral: number;
337
+ const grey: number;
338
+ const darkgrey: number;
339
+ const lime: number;
340
+ const brown: number;
341
+ const blue: number;
342
+ const green: number;
343
+ const teal: number;
344
+ const forest: number;
345
+ const black: number;
346
+ const gold: number;
347
+ const brick: number;
348
+ const gray: number;
349
+ const cyan: number;
350
+ const royal: number;
351
+ const violet: number;
352
+ const yellow: number;
353
+ const clear: number;
354
+ const orange: number;
355
+ const maroon: number;
356
+ const red: number;
357
+ const darkgray: number;
358
+ const navy: number;
359
+ const scarlet: number;
360
+ const slate: number;
361
+ const olive: number;
362
+ const purple: number;
363
+ const acid: number;
364
+ const goldenrod: number;
365
+ const crimson: number;
366
+ const accent: number;
367
+ const unlaunched: number;
368
+ const highlight: number;
369
+ const stat: number;
370
+ const negstat: number;
371
+ }
372
+
373
+ declare namespace Weathers {
374
+ const snowing: unique symbol;
375
+ const rain: unique symbol;
376
+ const sandstorm: unique symbol;
377
+ const sporestorm: unique symbol;
378
+ const fog: unique symbol;
379
+ const suspendParticles: unique symbol;
380
+ }
381
+
382
+ interface Sounds {
383
+ readonly artillery: number;
384
+ readonly back: number;
385
+ readonly bang: number;
386
+ readonly beam: number;
387
+ readonly bigshot: number;
388
+ readonly bioLoop: number;
389
+ readonly blaster: number;
390
+ readonly bolt: number;
391
+ readonly boom: number;
392
+ readonly break: number;
393
+ readonly build: number;
394
+ readonly buttonClick: number;
395
+ readonly cannon: number;
396
+ readonly chatMessage: number;
397
+ readonly click: number;
398
+ readonly combustion: number;
399
+ readonly conveyor: number;
400
+ readonly corexplode: number;
401
+ readonly cutter: number;
402
+ readonly door: number;
403
+ readonly drill: number;
404
+ readonly drillCharge: number;
405
+ readonly drillImpact: number;
406
+ readonly dullExplosion: number;
407
+ readonly electricHum: number;
408
+ readonly explosion: number;
409
+ readonly explosionbig: number;
410
+ readonly extractLoop: number;
411
+ readonly fire: number;
412
+ readonly flame: number;
413
+ readonly flame2: number;
414
+ readonly flux: number;
415
+ readonly glow: number;
416
+ readonly grinding: number;
417
+ readonly hum: number;
418
+ readonly largeCannon: number;
419
+ readonly largeExplosion: number;
420
+ readonly laser: number;
421
+ readonly laserbeam: number;
422
+ readonly laserbig: number;
423
+ readonly laserblast: number;
424
+ readonly lasercharge: number;
425
+ readonly lasercharge2: number;
426
+ readonly lasershoot: number;
427
+ readonly machine: number;
428
+ readonly malignShoot: number;
429
+ readonly mediumCannon: number;
430
+ readonly message: number;
431
+ readonly mineDeploy: number;
432
+ readonly minebeam: number;
433
+ readonly missile: number;
434
+ readonly missileLarge: number;
435
+ readonly missileLaunch: number;
436
+ readonly missileSmall: number;
437
+ readonly missileTrail: number;
438
+ readonly mud: number;
439
+ readonly noammo: number;
440
+ readonly pew: number;
441
+ readonly place: number;
442
+ readonly plantBreak: number;
443
+ readonly plasmaboom: number;
444
+ readonly plasmadrop: number;
445
+ readonly press: number;
446
+ readonly pulse: number;
447
+ readonly pulseBlast: number;
448
+ readonly railgun: number;
449
+ readonly rain: number;
450
+ readonly release: number;
451
+ readonly respawn: number;
452
+ readonly respawning: number;
453
+ readonly rockBreak: number;
454
+ readonly sap: number;
455
+ readonly shield: number;
456
+ readonly shockBlast: number;
457
+ readonly shoot: number;
458
+ readonly shootAlt: number;
459
+ readonly shootAltLong: number;
460
+ readonly shootBig: number;
461
+ readonly shootSmite: number;
462
+ readonly shootSnap: number;
463
+ readonly shotgun: number;
464
+ readonly smelter: number;
465
+ readonly spark: number;
466
+ readonly spellLoop: number;
467
+ readonly splash: number;
468
+ readonly spray: number;
469
+ readonly steam: number;
470
+ readonly techloop: number;
471
+ readonly thruster: number;
472
+ readonly titanExplosion: number;
473
+ readonly torch: number;
474
+ readonly tractorbeam: number;
475
+ readonly unlock: number;
476
+ readonly wave: number;
477
+ readonly wind: number;
478
+ readonly wind2: number;
479
+ readonly wind3: number;
480
+ readonly windhowl: number;
481
+ }
482
+
483
+ declare const Sounds: Sounds;
484
+
485
+ type WeatherSymbol = (typeof Weathers)[keyof typeof Weathers];
486
+
252
487
  interface BuildingSymbolTable {
253
488
  readonly graphitePress: unique symbol;
254
489
  readonly multiPress: unique symbol;
@@ -454,12 +689,24 @@ interface BuildingSymbolTable {
454
689
  readonly tetrativeReconstructor: unique symbol;
455
690
  readonly repairPoint: unique symbol;
456
691
  readonly repairTurret: unique symbol;
692
+ readonly tankFabricator: unique symbol;
693
+ readonly shipFabricator: unique symbol;
694
+ readonly mechFabricator: unique symbol;
695
+ readonly tankRefabricator: unique symbol;
696
+ readonly mechRefabricator: unique symbol;
697
+ readonly shipRefabricator: unique symbol;
698
+ readonly primeRefabricator: unique symbol;
699
+ readonly tankAssembler: unique symbol;
700
+ readonly shipAssembler: unique symbol;
701
+ readonly mechAssembler: unique symbol;
702
+ readonly basicAssemblerModule: unique symbol;
703
+ readonly unitRepairTower: unique symbol;
457
704
  readonly payloadConveyor: unique symbol;
458
705
  readonly payloadRouter: unique symbol;
459
706
  readonly reinforcedPayloadConveyor: unique symbol;
460
707
  readonly reinforcedPayloadRouter: unique symbol;
461
708
  readonly payloadMassDriver: unique symbol;
462
- readonly payloadPropulsionTower: unique symbol;
709
+ readonly largePayloadMassDriver: unique symbol;
463
710
  readonly smallDeconstructor: unique symbol;
464
711
  readonly deconstructor: unique symbol;
465
712
  readonly constructor: unique symbol;
@@ -488,15 +735,16 @@ interface BuildingSymbolTable {
488
735
  readonly logicDisplay: unique symbol;
489
736
  readonly largeLogicDisplay: unique symbol;
490
737
  readonly canvas: unique symbol;
738
+ readonly reinforcedMessage: unique symbol;
491
739
  readonly worldProcessor: unique symbol;
492
740
  readonly worldCell: unique symbol;
741
+ readonly worldMessage: unique symbol;
742
+ readonly worldSwitch: unique symbol;
493
743
  }
494
744
 
495
745
  type BuildingSymbol = Blocks[keyof BuildingSymbolTable];
496
746
 
497
747
  interface EnvBlockSymbolTable {
498
- // used by some instructions to represent any env block
499
- readonly solid: EnvBlockSymbolTable["stoneWall"];
500
748
  readonly air: unique symbol;
501
749
  readonly spawn: unique symbol;
502
750
  readonly cliff: unique symbol;
@@ -645,9 +893,52 @@ interface OreSymbolTable {
645
893
  type OreSymbol = Blocks[keyof OreSymbolTable];
646
894
 
647
895
  interface Blocks
648
- extends BuildingSymbolTable,
649
- EnvBlockSymbolTable,
650
- OreSymbolTable {}
896
+ extends BuildingSymbolTable, EnvBlockSymbolTable, OreSymbolTable {
897
+ readonly build1: unique symbol;
898
+ readonly build2: unique symbol;
899
+ readonly build3: unique symbol;
900
+ readonly build4: unique symbol;
901
+ readonly build5: unique symbol;
902
+ readonly build6: unique symbol;
903
+ readonly build7: unique symbol;
904
+ readonly build8: unique symbol;
905
+ readonly build9: unique symbol;
906
+ readonly build10: unique symbol;
907
+ readonly build11: unique symbol;
908
+ readonly build12: unique symbol;
909
+ readonly build13: unique symbol;
910
+ readonly build14: unique symbol;
911
+ readonly build15: unique symbol;
912
+ readonly build16: unique symbol;
913
+ }
651
914
 
652
915
  type BlockSymbol = Blocks[keyof Blocks];
653
916
  declare const Blocks: Blocks;
917
+
918
+ declare namespace StatusEffects {
919
+ const none: StatusEffectSymbol;
920
+ const burning: StatusEffectSymbol;
921
+ const freezing: StatusEffectSymbol;
922
+ const unmoving: StatusEffectSymbol;
923
+ const slow: StatusEffectSymbol;
924
+ const fast: StatusEffectSymbol;
925
+ const wet: StatusEffectSymbol;
926
+ const muddy: StatusEffectSymbol;
927
+ const melting: StatusEffectSymbol;
928
+ const sapped: StatusEffectSymbol;
929
+ const tarred: StatusEffectSymbol;
930
+ const overdrive: StatusEffectSymbol;
931
+ const overclock: StatusEffectSymbol;
932
+ const shielded: StatusEffectSymbol;
933
+ const shocked: StatusEffectSymbol;
934
+ const blasted: StatusEffectSymbol;
935
+ const corroded: StatusEffectSymbol;
936
+ const boss: StatusEffectSymbol;
937
+ const sporeSlowed: StatusEffectSymbol;
938
+ const disarmed: StatusEffectSymbol;
939
+ const electrified: StatusEffectSymbol;
940
+ const invincible: StatusEffectSymbol;
941
+ const dynamic: StatusEffectSymbol;
942
+ }
943
+
944
+ type StatusEffectSymbol = symbol & { readonly __statusEffect: unique symbol };
package/lib/helpers.d.ts CHANGED
@@ -1,54 +1,88 @@
1
1
  /// <reference path="./kinds.d.ts" />
2
2
 
3
- /**
4
- * Allows getting unlisted processor variables or symbols.
5
- *
6
- * Using this method is discouraged because most values are
7
- * already accessible under the namespaces `Units`, `Blocks`,
8
- * `Items`, `Liquids`, `ControlKind` and `Vars`.
9
- *
10
- * @param name The identifier of the value
11
- */
12
- declare function getVar<T>(name: string): T;
13
-
14
- /**
15
- * Gets a building linked to the processor by its name.
16
- *
17
- * @param name
18
- */
19
- declare function getBuilding<T extends BasicBuilding = AnyBuilding>(
20
- name: string
21
- ): T;
22
-
23
- type ConcatLiteral = string | number | boolean | undefined;
24
-
25
- /**
26
- * Concatenates a list of constant literal values.
27
- *
28
- * ```js
29
- * const name = "example";
30
- *
31
- * // works with normal arguments
32
- * const before = concat("before_", name);
33
- *
34
- * // works with tagged template strings
35
- * const after = concat`after_${name}`;
36
- * ```
37
- */
38
- declare function concat(
39
- ...args: ConcatLiteral[] | [TemplateStringsArray, ...ConcatLiteral[]]
40
- ): string;
41
-
42
- /**
43
- * Inlines raw mlog code. Variables and expressions can be placed inside.
44
- *
45
- * Although possible, using this function is heavily not recommended since
46
- * you lose the benefits of getting type cheking and validation for some
47
- * commands.
48
- *
49
- * ```js
50
- * let x = 10
51
- * asm`ucontrol build ${x} ${x * 2} @router 0 0`
52
- * ```
53
- */
54
- declare function asm(strings: TemplateStringsArray, ...values: unknown[]): void;
3
+ import { TLogicLinkNames } from "mlogjs:types";
4
+
5
+ declare global {
6
+ /**
7
+ * Allows getting unlisted processor variables or symbols.
8
+ *
9
+ * Using this method is discouraged because most values are already accessible
10
+ * under the namespaces `Units`, `Blocks`, `Items`, `Liquids`, `ControlKind`
11
+ * and `Vars`.
12
+ *
13
+ * @param name The identifier of the value
14
+ */
15
+ function getVar<T>(name: string): T;
16
+
17
+ /**
18
+ * Gets a building linked to the processor by its name.
19
+ *
20
+ * @param name
21
+ */
22
+
23
+ function getBuilding<T extends BasicBuilding = AnyBuilding>(
24
+ name: TLogicLinkNames<keyof BuildingSymbolTable> | (string & {}),
25
+ ): T;
26
+
27
+ /**
28
+ * Returns a record of all the buildings linked to this processor.
29
+ *
30
+ * The use of this function is preferred if you are assigning buildings to
31
+ * multiple variables at once.
32
+ *
33
+ * ```js
34
+ * const { switch1: toggle, cell1 } = getBuildings();
35
+ * ```
36
+ */
37
+ function getBuildings<T extends BasicBuilding = AnyBuilding>(): Record<
38
+ TLogicLinkNames<keyof BuildingSymbolTable> | (string & {}),
39
+ T
40
+ >;
41
+
42
+ /**
43
+ * Gets a color literal from a hex code.
44
+ *
45
+ * ```js
46
+ * const color = getColor("0e7eba");
47
+ *
48
+ * draw.col(color);
49
+ * draw.rect({ x: 0, y: 0, width: 500, height: 500 });
50
+ *
51
+ * drawFlush();
52
+ * ```
53
+ */
54
+ function getColor(hexCode: string): number;
55
+
56
+ type ConcatLiteral = string | number | boolean | undefined;
57
+
58
+ /**
59
+ * Concatenates a list of constant literal values.
60
+ *
61
+ * ```js
62
+ * const name = "example";
63
+ *
64
+ * // works with normal arguments
65
+ * const before = concat("before_", name);
66
+ *
67
+ * // works with tagged template strings
68
+ * const after = concat`after_${name}`;
69
+ * ```
70
+ */
71
+ function concat(
72
+ ...args: ConcatLiteral[] | [TemplateStringsArray, ...ConcatLiteral[]]
73
+ ): string;
74
+
75
+ /**
76
+ * Inlines raw mlog code. Variables and expressions can be placed inside.
77
+ *
78
+ * Although possible, using this function is heavily not recommended since you
79
+ * lose the benefits of getting type cheking and validation for some
80
+ * commands.
81
+ *
82
+ * ```js
83
+ * let x = 10;
84
+ * asm`ucontrol build ${x} ${x * 2} @router 0 0`;
85
+ * ```
86
+ */
87
+ function asm(strings: TemplateStringsArray, ...values: unknown[]): void;
88
+ }
package/lib/kinds.d.ts CHANGED
@@ -1,24 +1,34 @@
1
1
  /// <reference path="./traits.d.ts" />
2
2
 
3
3
  interface BasicUnit
4
- extends ItemHolder,
4
+ extends
5
+ ItemHolder,
5
6
  Shooting,
6
7
  WithHealth,
8
+ WithShield,
7
9
  Rotatable,
8
10
  Spaced,
9
11
  Ranged,
12
+ Mining,
13
+ WithBuild,
14
+ Flying,
10
15
  Typed<UnitSymbol>,
11
16
  Flagged,
12
- Controllable,
17
+ Controlled,
18
+ WithController,
13
19
  Nameable,
20
+ PayloadHolder,
14
21
  WithSpeed,
15
22
  WithColor,
16
- WithTeam {}
23
+ WithTeam,
24
+ WithArmor,
25
+ WithVelocity {}
17
26
 
18
- interface AnyUnit extends BasicUnit, Boosted {}
27
+ interface AnyUnit extends BasicUnit, Boosted, WithCamera {}
19
28
 
20
29
  interface BasicBuilding
21
- extends LiquidHolder,
30
+ extends
31
+ LiquidHolder,
22
32
  ItemHolder,
23
33
  PowerHolder,
24
34
  WithHealth,
@@ -28,14 +38,39 @@ interface BasicBuilding
28
38
  Spaced,
29
39
  Ranged,
30
40
  Typed<BuildingSymbol>,
41
+ Controlled,
42
+ PayloadHolder,
31
43
  WithEnable,
32
44
  WithConfig,
33
45
  WithColor,
34
- WithTeam {}
46
+ WithTeam,
47
+ WithSolid,
48
+ WithMaxUnits {}
35
49
 
36
50
  interface BasicTurret extends BasicBuilding, Shooting, WithProgress {}
37
51
 
38
52
  // just to make this future proof
39
53
  interface AnyTurret extends BasicTurret {}
40
54
 
41
- interface AnyBuilding extends AnyTurret, Heatable {}
55
+ interface AnyBuilding
56
+ extends
57
+ AnyTurret,
58
+ Heatable,
59
+ WithShield,
60
+ WithMemory,
61
+ WithBufferSize,
62
+ WithDisplay,
63
+ WithOperations {}
64
+
65
+ interface Bullet
66
+ extends
67
+ Rotatable,
68
+ WithHealth,
69
+ Spaced,
70
+ WithVelocity,
71
+ WithTeam,
72
+ Ranged,
73
+ WithAim,
74
+ WithSpeed,
75
+ WithColor,
76
+ WithBulletTime {}