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.
- package/LICENSE +21 -21
- package/README.md +68 -18
- package/build/Compiler.d.ts +18 -18
- package/build/Compiler.js +99 -119
- package/build/Compiler.js.map +1 -1
- package/build/Scope.d.ts +26 -26
- package/build/Scope.js +60 -60
- package/build/Scope.js.map +1 -1
- package/build/bin.d.ts +2 -2
- package/build/bin.js +60 -41
- package/build/bin.js.map +1 -1
- package/build/handlers/BlockStatement.d.ts +2 -2
- package/build/handlers/BlockStatement.js +13 -13
- package/build/handlers/CallExpression.d.ts +3 -3
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/ForStatement.d.ts +2 -2
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/Function.d.ts +4 -4
- package/build/handlers/Function.js +35 -35
- package/build/handlers/Identifier.d.ts +2 -2
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/IfStatement.d.ts +2 -2
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/Literal.d.ts +2 -2
- package/build/handlers/Literal.js +17 -17
- package/build/handlers/Object.d.ts +4 -4
- package/build/handlers/Object.js +43 -43
- package/build/handlers/OperationExpressions.d.ts +7 -7
- package/build/handlers/OperationExpressions.js +32 -32
- package/build/handlers/Program.d.ts +2 -2
- package/build/handlers/Program.js +8 -8
- package/build/handlers/Program.js.map +1 -1
- package/build/handlers/Statements.d.ts +5 -5
- package/build/handlers/Statements.js +29 -29
- package/build/handlers/TemplateExpression.d.ts +2 -2
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/VariableDeclaration.d.ts +3 -3
- package/build/handlers/VariableDeclaration.js +55 -55
- package/build/handlers/WhileStatement.d.ts +2 -2
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/index.d.ts +14 -14
- package/build/handlers/index.js +30 -30
- package/build/index.d.ts +1 -1
- package/build/index.js +7 -7
- package/build/initScope.d.ts +2 -0
- package/build/initScope.js +40 -0
- package/build/initScope.js.map +1 -0
- package/build/instructions/AddressResolver.d.ts +12 -12
- package/build/instructions/AddressResolver.js +30 -30
- package/build/instructions/ControlInstructions.d.ts +11 -11
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/EndInstruction.d.ts +4 -4
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/InstructionBase.d.ts +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/JumpInstruction.d.ts +15 -15
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/OperationInstruction.d.ts +5 -5
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/SetCounterInstruction.d.ts +5 -5
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetInstruction.d.ts +5 -5
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/index.d.ts +9 -9
- package/build/instructions/index.js +25 -25
- package/build/macros/Building.d.ts +11 -11
- package/build/macros/Building.js +80 -80
- package/build/macros/Function.d.ts +12 -12
- package/build/macros/Function.js +19 -19
- package/build/macros/Math.d.ts +5 -5
- package/build/macros/Math.js +56 -56
- package/build/macros/Math.js.map +1 -1
- package/build/macros/Memory.d.ts +5 -5
- package/build/macros/Memory.js +60 -60
- package/build/macros/Namespace.d.ts +21 -21
- package/build/macros/Namespace.js +97 -97
- package/build/macros/Other.d.ts +5 -5
- package/build/macros/Other.js +19 -19
- package/build/macros/RawValue.d.ts +5 -5
- package/build/macros/RawValue.js +15 -15
- package/build/macros/commands/{control.d.ts → Control.d.ts} +5 -5
- package/build/macros/commands/{control.js → Control.js} +24 -24
- package/build/macros/commands/{control.js.map → Control.js.map} +0 -0
- package/build/macros/commands/Draw.d.ts +5 -5
- package/build/macros/commands/Draw.js +38 -38
- package/build/macros/commands/DrawFlush.d.ts +5 -5
- package/build/macros/commands/DrawFlush.js +16 -16
- package/build/macros/commands/GetLink.d.ts +5 -5
- package/build/macros/commands/GetLink.js +20 -20
- package/build/macros/commands/Lookup.d.ts +5 -5
- package/build/macros/commands/Lookup.js +23 -23
- package/build/macros/commands/Print.d.ts +5 -5
- package/build/macros/commands/Print.js +13 -13
- package/build/macros/commands/PrintFlush.d.ts +5 -5
- package/build/macros/commands/PrintFlush.js +16 -16
- package/build/macros/commands/Radar.d.ts +7 -7
- package/build/macros/commands/Radar.js +60 -60
- package/build/macros/commands/Sensor.d.ts +5 -5
- package/build/macros/commands/Sensor.js +19 -19
- package/build/macros/commands/UnitBind.d.ts +5 -5
- package/build/macros/commands/UnitBind.js +16 -16
- package/build/macros/commands/UnitControl.d.ts +5 -5
- package/build/macros/commands/UnitControl.js +67 -67
- package/build/macros/commands/UnitLocate.d.ts +5 -5
- package/build/macros/commands/UnitLocate.js +54 -54
- package/build/macros/commands/UnitRadar.d.ts +5 -5
- package/build/macros/commands/UnitRadar.js +40 -40
- package/build/macros/commands/Wait.d.ts +5 -5
- package/build/macros/commands/Wait.js +17 -17
- package/build/macros/commands/index.d.ts +14 -14
- package/build/macros/commands/index.js +32 -32
- package/build/macros/index.d.ts +7 -7
- package/build/macros/index.js +39 -39
- package/build/operators.d.ts +25 -25
- package/build/operators.js +101 -101
- package/build/types.d.ts +49 -49
- package/build/types.js +27 -27
- package/build/utils.d.ts +3 -3
- package/build/utils.js +12 -12
- package/build/values/BaseValue.d.ts +5 -5
- package/build/values/BaseValue.js +111 -111
- package/build/values/FunctionValue.d.ts +34 -34
- package/build/values/FunctionValue.js +103 -103
- package/build/values/LiteralValue.d.ts +12 -12
- package/build/values/LiteralValue.js +87 -87
- package/build/values/LiteralValue.js.map +1 -1
- package/build/values/ObjectValue.d.ts +17 -17
- package/build/values/ObjectValue.js +49 -49
- package/build/values/StoreValue.d.ts +11 -11
- package/build/values/StoreValue.js +30 -30
- package/build/values/TempValue.d.ts +12 -12
- package/build/values/TempValue.js +66 -66
- package/build/values/TempValue.js.map +1 -1
- package/build/values/VoidValue.d.ts +11 -11
- package/build/values/VoidValue.js +30 -30
- package/build/values/index.d.ts +6 -6
- package/build/values/index.js +22 -22
- package/dist/mlogjs.es.js +6366 -0
- package/dist/mlogjs.umd.js +8 -0
- package/lib/commands.d.ts +326 -326
- package/lib/eslib/index.d.ts +3 -3
- package/lib/eslib/lib.d.ts +9 -9
- package/lib/eslib/lib.es2015.collection.d.ts +89 -89
- package/lib/eslib/lib.es2015.core.d.ts +16 -16
- package/lib/eslib/lib.es2015.d.ts +30 -30
- package/lib/eslib/lib.es2015.generator.d.ts +79 -79
- package/lib/eslib/lib.es2015.iterable.d.ts +70 -70
- package/lib/eslib/lib.es5.d.ts +295 -295
- package/lib/eslib/lib.es6.d.ts +18 -18
- package/lib/globals.d.ts +328 -328
- package/lib/helpers.d.ts +23 -23
- package/lib/index.d.ts +7 -7
- package/lib/kinds.d.ts +36 -36
- package/lib/memory.d.ts +17 -17
- package/lib/traits.d.ts +121 -121
- package/lib/util.d.ts +32 -32
- package/package.json +73 -48
- package/build/macros/Blocks.d.ts +0 -5
- package/build/macros/Blocks.js +0 -143
- package/build/macros/Blocks.js.map +0 -1
- package/build/macros/Draw.d.ts +0 -5
- package/build/macros/Draw.js +0 -39
- package/build/macros/Draw.js.map +0 -1
- package/build/macros/Items.d.ts +0 -5
- package/build/macros/Items.js +0 -20
- package/build/macros/Items.js.map +0 -1
- package/build/macros/Liquids.d.ts +0 -5
- package/build/macros/Liquids.js +0 -18
- package/build/macros/Liquids.js.map +0 -1
- package/build/macros/Symbol.d.ts +0 -0
- package/build/macros/Symbol.js +0 -1
- package/build/macros/Symbol.js.map +0 -1
- package/build/macros/SymbolNamespace.d.ts +0 -0
- package/build/macros/SymbolNamespace.js +0 -1
- package/build/macros/SymbolNamespace.js.map +0 -1
- package/build/macros/TypeFactory.d.ts +0 -8
- package/build/macros/TypeFactory.js +0 -22
- package/build/macros/TypeFactory.js.map +0 -1
- package/build/macros/Units.d.ts +0 -5
- package/build/macros/Units.js +0 -18
- package/build/macros/Units.js.map +0 -1
- package/build/macros/Vars.d.ts +0 -5
- package/build/macros/Vars.js +0 -18
- package/build/macros/Vars.js.map +0 -1
- package/build/macros/commands/Asm.d.ts +0 -5
- package/build/macros/commands/Asm.js +0 -21
- package/build/macros/commands/Asm.js.map +0 -1
- package/build/macros/commands/io.d.ts +0 -8
- package/build/macros/commands/io.js +0 -47
- package/build/macros/commands/io.js.map +0 -1
- package/build/macros/helpers/GetBuilding.d.ts +0 -5
- package/build/macros/helpers/GetBuilding.js +0 -16
- package/build/macros/helpers/GetBuilding.js.map +0 -1
- package/build/macros/helpers/GetVar.d.ts +0 -5
- package/build/macros/helpers/GetVar.js +0 -16
- package/build/macros/helpers/GetVar.js.map +0 -1
- package/build/macros/helpers/index.d.ts +0 -2
- package/build/macros/helpers/index.js +0 -15
- package/build/macros/helpers/index.js.map +0 -1
- package/dist/bundle.js +0 -1
package/lib/helpers.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/// <reference path="./kinds.d.ts" />
|
|
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`, `Vars` and `UnitCommands`.
|
|
9
|
-
*
|
|
10
|
-
* @param key The identifier of the value
|
|
11
|
-
*/
|
|
12
|
-
declare function getVar<T>(key: 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
|
-
declare function concat(...strings: string[]): string;
|
|
1
|
+
/// <reference path="./kinds.d.ts" />
|
|
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`, `Vars` and `UnitCommands`.
|
|
9
|
+
*
|
|
10
|
+
* @param key The identifier of the value
|
|
11
|
+
*/
|
|
12
|
+
declare function getVar<T>(key: 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
|
+
declare function concat(...strings: string[]): string;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/// <reference path="./eslib/index.d.ts" />
|
|
2
|
-
/// <reference path="./commands.d.ts" />
|
|
3
|
-
/// <reference path="./globals.d.ts" />
|
|
4
|
-
/// <reference path="./helpers.d.ts" />
|
|
5
|
-
/// <reference path="./kinds.d.ts" />
|
|
6
|
-
/// <reference path="./memory.d.ts" />
|
|
7
|
-
/// <reference path="./traits.d.ts" />
|
|
1
|
+
/// <reference path="./eslib/index.d.ts" />
|
|
2
|
+
/// <reference path="./commands.d.ts" />
|
|
3
|
+
/// <reference path="./globals.d.ts" />
|
|
4
|
+
/// <reference path="./helpers.d.ts" />
|
|
5
|
+
/// <reference path="./kinds.d.ts" />
|
|
6
|
+
/// <reference path="./memory.d.ts" />
|
|
7
|
+
/// <reference path="./traits.d.ts" />
|
package/lib/kinds.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/// <reference path="./traits.d.ts" />
|
|
2
|
-
|
|
3
|
-
interface BasicUnit
|
|
4
|
-
extends ItemHolder,
|
|
5
|
-
Shooting,
|
|
6
|
-
WithHealth,
|
|
7
|
-
Rotatable,
|
|
8
|
-
Spaced,
|
|
9
|
-
Ranged,
|
|
10
|
-
Typed<UnitSymbol>,
|
|
11
|
-
Flagged,
|
|
12
|
-
Controllable,
|
|
13
|
-
Nameable {}
|
|
14
|
-
|
|
15
|
-
interface AnyUnit extends BasicUnit, Boosted {}
|
|
16
|
-
|
|
17
|
-
interface BasicBuilding
|
|
18
|
-
extends LiquidHolder,
|
|
19
|
-
ItemHolder,
|
|
20
|
-
PowerHolder,
|
|
21
|
-
WithHealth,
|
|
22
|
-
WithEffiency,
|
|
23
|
-
WithTimescale,
|
|
24
|
-
Rotatable,
|
|
25
|
-
Spaced,
|
|
26
|
-
Ranged,
|
|
27
|
-
Typed<BlockSymbol>,
|
|
28
|
-
WithEnable,
|
|
29
|
-
WithConfig {}
|
|
30
|
-
|
|
31
|
-
interface BasicTurret extends BasicBuilding, Shooting, WithProgress {}
|
|
32
|
-
|
|
33
|
-
// just to make this future proof
|
|
34
|
-
interface AnyTurret extends BasicTurret {}
|
|
35
|
-
|
|
36
|
-
interface AnyBuilding extends AnyTurret, Heatable {}
|
|
1
|
+
/// <reference path="./traits.d.ts" />
|
|
2
|
+
|
|
3
|
+
interface BasicUnit
|
|
4
|
+
extends ItemHolder,
|
|
5
|
+
Shooting,
|
|
6
|
+
WithHealth,
|
|
7
|
+
Rotatable,
|
|
8
|
+
Spaced,
|
|
9
|
+
Ranged,
|
|
10
|
+
Typed<UnitSymbol>,
|
|
11
|
+
Flagged,
|
|
12
|
+
Controllable,
|
|
13
|
+
Nameable {}
|
|
14
|
+
|
|
15
|
+
interface AnyUnit extends BasicUnit, Boosted {}
|
|
16
|
+
|
|
17
|
+
interface BasicBuilding
|
|
18
|
+
extends LiquidHolder,
|
|
19
|
+
ItemHolder,
|
|
20
|
+
PowerHolder,
|
|
21
|
+
WithHealth,
|
|
22
|
+
WithEffiency,
|
|
23
|
+
WithTimescale,
|
|
24
|
+
Rotatable,
|
|
25
|
+
Spaced,
|
|
26
|
+
Ranged,
|
|
27
|
+
Typed<BlockSymbol>,
|
|
28
|
+
WithEnable,
|
|
29
|
+
WithConfig {}
|
|
30
|
+
|
|
31
|
+
interface BasicTurret extends BasicBuilding, Shooting, WithProgress {}
|
|
32
|
+
|
|
33
|
+
// just to make this future proof
|
|
34
|
+
interface AnyTurret extends BasicTurret {}
|
|
35
|
+
|
|
36
|
+
interface AnyBuilding extends AnyTurret, Heatable {}
|
package/lib/memory.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/// <reference path="./kinds.d.ts" />
|
|
2
|
-
|
|
3
|
-
type MemoryCapacity = 64 | 512;
|
|
4
|
-
/**
|
|
5
|
-
* A wrapper around memory cells/banks that is compatible with custom types.
|
|
6
|
-
*/
|
|
7
|
-
declare class Memory<S extends MemoryCapacity = 64> {
|
|
8
|
-
constructor(cell: BasicBuilding, size?: S);
|
|
9
|
-
|
|
10
|
-
[Symbol.iterator](): IterableIterator<number>;
|
|
11
|
-
[index: number]: number;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The practical length of the memory view.
|
|
15
|
-
*/
|
|
16
|
-
readonly length: S;
|
|
17
|
-
}
|
|
1
|
+
/// <reference path="./kinds.d.ts" />
|
|
2
|
+
|
|
3
|
+
type MemoryCapacity = 64 | 512;
|
|
4
|
+
/**
|
|
5
|
+
* A wrapper around memory cells/banks that is compatible with custom types.
|
|
6
|
+
*/
|
|
7
|
+
declare class Memory<S extends MemoryCapacity = 64> {
|
|
8
|
+
constructor(cell: BasicBuilding, size?: S);
|
|
9
|
+
|
|
10
|
+
[Symbol.iterator](): IterableIterator<number>;
|
|
11
|
+
[index: number]: number;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The practical length of the memory view.
|
|
15
|
+
*/
|
|
16
|
+
readonly length: S;
|
|
17
|
+
}
|
package/lib/traits.d.ts
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import "./globals";
|
|
2
|
-
import "./custom-lib";
|
|
3
|
-
|
|
4
|
-
type LogicSymbols = typeof Items & typeof Liquids & typeof LAccess;
|
|
5
|
-
|
|
6
|
-
type WithSymbols<T extends Record<string, unknown>> = T & {
|
|
7
|
-
readonly [K in keyof (LogicSymbols | T) as LogicSymbols[K]]: T[K];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
declare global {
|
|
11
|
-
type LiquidHolder = WithSymbols<
|
|
12
|
-
{
|
|
13
|
-
readonly [L in keyof typeof Liquids]: number;
|
|
14
|
-
} & {
|
|
15
|
-
readonly totalLiquids: number;
|
|
16
|
-
readonly liquidCapacity: number;
|
|
17
|
-
}
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
|
-
type ItemHolder = WithSymbols<
|
|
21
|
-
{
|
|
22
|
-
readonly [I in keyof typeof Items]: number;
|
|
23
|
-
} & {
|
|
24
|
-
readonly totalItems: number;
|
|
25
|
-
readonly firstItem: ItemSymbol | null;
|
|
26
|
-
readonly itemCapacity: number;
|
|
27
|
-
}
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
|
-
type PowerHolder = WithSymbols<{
|
|
31
|
-
readonly totalPower: number;
|
|
32
|
-
readonly powerCapacity: number;
|
|
33
|
-
readonly powerNetStored: number;
|
|
34
|
-
readonly powerNetCapacity: number;
|
|
35
|
-
readonly powerNetIn: number;
|
|
36
|
-
readonly powerNetOut: number;
|
|
37
|
-
}>;
|
|
38
|
-
|
|
39
|
-
type Shooting = WithSymbols<{
|
|
40
|
-
readonly shootX: number;
|
|
41
|
-
readonly shootY: number;
|
|
42
|
-
readonly ammo: number;
|
|
43
|
-
readonly ammoCapacity: number;
|
|
44
|
-
}>;
|
|
45
|
-
|
|
46
|
-
type WithHealth = WithSymbols<{
|
|
47
|
-
readonly health: number;
|
|
48
|
-
readonly maxHealth: number;
|
|
49
|
-
readonly dead: boolean;
|
|
50
|
-
}>;
|
|
51
|
-
|
|
52
|
-
type Heatable = WithSymbols<{
|
|
53
|
-
readonly heat: number;
|
|
54
|
-
}>;
|
|
55
|
-
|
|
56
|
-
type WithEffiency = WithSymbols<{
|
|
57
|
-
readonly efficiency: number;
|
|
58
|
-
}>;
|
|
59
|
-
|
|
60
|
-
type WithProgress = WithSymbols<{
|
|
61
|
-
readonly progress: number;
|
|
62
|
-
}>;
|
|
63
|
-
|
|
64
|
-
type WithTimescale = WithSymbols<{
|
|
65
|
-
readonly timescale: number;
|
|
66
|
-
}>;
|
|
67
|
-
|
|
68
|
-
type Rotatable = WithSymbols<{
|
|
69
|
-
readonly rotation: number;
|
|
70
|
-
}>;
|
|
71
|
-
|
|
72
|
-
type Spaced = WithSymbols<{
|
|
73
|
-
readonly x: number;
|
|
74
|
-
readonly y: number;
|
|
75
|
-
readonly size: number;
|
|
76
|
-
}>;
|
|
77
|
-
|
|
78
|
-
type Ranged = WithSymbols<{
|
|
79
|
-
readonly range: number;
|
|
80
|
-
}>;
|
|
81
|
-
|
|
82
|
-
type Boosted = WithSymbols<{
|
|
83
|
-
readonly boosting: number;
|
|
84
|
-
}>;
|
|
85
|
-
|
|
86
|
-
type Mining = WithSymbols<{
|
|
87
|
-
readonly mineX: number;
|
|
88
|
-
readonly mineY: number;
|
|
89
|
-
readonly mining: number;
|
|
90
|
-
}>;
|
|
91
|
-
|
|
92
|
-
type Typed<T extends symbol = symbol> = WithSymbols<{
|
|
93
|
-
readonly type: T;
|
|
94
|
-
}>;
|
|
95
|
-
type Flagged = WithSymbols<{
|
|
96
|
-
readonly flag: number;
|
|
97
|
-
}>;
|
|
98
|
-
|
|
99
|
-
type Controllable = WithSymbols<{
|
|
100
|
-
readonly controlled: 0 | ControlKind;
|
|
101
|
-
readonly controller: AnyUnit | BasicBuilding;
|
|
102
|
-
}>;
|
|
103
|
-
|
|
104
|
-
type Nameable = WithSymbols<{
|
|
105
|
-
readonly name: string | null;
|
|
106
|
-
}>;
|
|
107
|
-
|
|
108
|
-
type PayloadHolder = WithSymbols<{
|
|
109
|
-
readonly payloadCount: number;
|
|
110
|
-
readonly payloadType: symbol | null;
|
|
111
|
-
}>;
|
|
112
|
-
|
|
113
|
-
type WithEnable = WithSymbols<{
|
|
114
|
-
enabled: boolean;
|
|
115
|
-
}>;
|
|
116
|
-
|
|
117
|
-
type WithConfig<T extends symbol | number | null = symbol | null> =
|
|
118
|
-
WithSymbols<{
|
|
119
|
-
readonly config: T;
|
|
120
|
-
}>;
|
|
121
|
-
}
|
|
1
|
+
import "./globals";
|
|
2
|
+
import "./custom-lib";
|
|
3
|
+
|
|
4
|
+
type LogicSymbols = typeof Items & typeof Liquids & typeof LAccess;
|
|
5
|
+
|
|
6
|
+
type WithSymbols<T extends Record<string, unknown>> = T & {
|
|
7
|
+
readonly [K in keyof (LogicSymbols | T) as LogicSymbols[K]]: T[K];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
type LiquidHolder = WithSymbols<
|
|
12
|
+
{
|
|
13
|
+
readonly [L in keyof typeof Liquids]: number;
|
|
14
|
+
} & {
|
|
15
|
+
readonly totalLiquids: number;
|
|
16
|
+
readonly liquidCapacity: number;
|
|
17
|
+
}
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
type ItemHolder = WithSymbols<
|
|
21
|
+
{
|
|
22
|
+
readonly [I in keyof typeof Items]: number;
|
|
23
|
+
} & {
|
|
24
|
+
readonly totalItems: number;
|
|
25
|
+
readonly firstItem: ItemSymbol | null;
|
|
26
|
+
readonly itemCapacity: number;
|
|
27
|
+
}
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
type PowerHolder = WithSymbols<{
|
|
31
|
+
readonly totalPower: number;
|
|
32
|
+
readonly powerCapacity: number;
|
|
33
|
+
readonly powerNetStored: number;
|
|
34
|
+
readonly powerNetCapacity: number;
|
|
35
|
+
readonly powerNetIn: number;
|
|
36
|
+
readonly powerNetOut: number;
|
|
37
|
+
}>;
|
|
38
|
+
|
|
39
|
+
type Shooting = WithSymbols<{
|
|
40
|
+
readonly shootX: number;
|
|
41
|
+
readonly shootY: number;
|
|
42
|
+
readonly ammo: number;
|
|
43
|
+
readonly ammoCapacity: number;
|
|
44
|
+
}>;
|
|
45
|
+
|
|
46
|
+
type WithHealth = WithSymbols<{
|
|
47
|
+
readonly health: number;
|
|
48
|
+
readonly maxHealth: number;
|
|
49
|
+
readonly dead: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
|
|
52
|
+
type Heatable = WithSymbols<{
|
|
53
|
+
readonly heat: number;
|
|
54
|
+
}>;
|
|
55
|
+
|
|
56
|
+
type WithEffiency = WithSymbols<{
|
|
57
|
+
readonly efficiency: number;
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
type WithProgress = WithSymbols<{
|
|
61
|
+
readonly progress: number;
|
|
62
|
+
}>;
|
|
63
|
+
|
|
64
|
+
type WithTimescale = WithSymbols<{
|
|
65
|
+
readonly timescale: number;
|
|
66
|
+
}>;
|
|
67
|
+
|
|
68
|
+
type Rotatable = WithSymbols<{
|
|
69
|
+
readonly rotation: number;
|
|
70
|
+
}>;
|
|
71
|
+
|
|
72
|
+
type Spaced = WithSymbols<{
|
|
73
|
+
readonly x: number;
|
|
74
|
+
readonly y: number;
|
|
75
|
+
readonly size: number;
|
|
76
|
+
}>;
|
|
77
|
+
|
|
78
|
+
type Ranged = WithSymbols<{
|
|
79
|
+
readonly range: number;
|
|
80
|
+
}>;
|
|
81
|
+
|
|
82
|
+
type Boosted = WithSymbols<{
|
|
83
|
+
readonly boosting: number;
|
|
84
|
+
}>;
|
|
85
|
+
|
|
86
|
+
type Mining = WithSymbols<{
|
|
87
|
+
readonly mineX: number;
|
|
88
|
+
readonly mineY: number;
|
|
89
|
+
readonly mining: number;
|
|
90
|
+
}>;
|
|
91
|
+
|
|
92
|
+
type Typed<T extends symbol = symbol> = WithSymbols<{
|
|
93
|
+
readonly type: T;
|
|
94
|
+
}>;
|
|
95
|
+
type Flagged = WithSymbols<{
|
|
96
|
+
readonly flag: number;
|
|
97
|
+
}>;
|
|
98
|
+
|
|
99
|
+
type Controllable = WithSymbols<{
|
|
100
|
+
readonly controlled: 0 | ControlKind;
|
|
101
|
+
readonly controller: AnyUnit | BasicBuilding;
|
|
102
|
+
}>;
|
|
103
|
+
|
|
104
|
+
type Nameable = WithSymbols<{
|
|
105
|
+
readonly name: string | null;
|
|
106
|
+
}>;
|
|
107
|
+
|
|
108
|
+
type PayloadHolder = WithSymbols<{
|
|
109
|
+
readonly payloadCount: number;
|
|
110
|
+
readonly payloadType: symbol | null;
|
|
111
|
+
}>;
|
|
112
|
+
|
|
113
|
+
type WithEnable = WithSymbols<{
|
|
114
|
+
enabled: boolean;
|
|
115
|
+
}>;
|
|
116
|
+
|
|
117
|
+
type WithConfig<T extends symbol | number | null = symbol | null> =
|
|
118
|
+
WithSymbols<{
|
|
119
|
+
readonly config: T;
|
|
120
|
+
}>;
|
|
121
|
+
}
|
package/lib/util.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export type TRadarFilter =
|
|
2
|
-
| "any"
|
|
3
|
-
| "enemy"
|
|
4
|
-
| "ally"
|
|
5
|
-
| "player"
|
|
6
|
-
| "attacker"
|
|
7
|
-
| "flying"
|
|
8
|
-
| "boss"
|
|
9
|
-
| "ground";
|
|
10
|
-
|
|
11
|
-
export type TRadarFilterArray =
|
|
12
|
-
| [TRadarFilter]
|
|
13
|
-
| [TRadarFilter, TRadarFilter]
|
|
14
|
-
| [TRadarFilter, TRadarFilter, TRadarFilter];
|
|
15
|
-
|
|
16
|
-
export type TRadarSort =
|
|
17
|
-
| "distance"
|
|
18
|
-
| "health"
|
|
19
|
-
| "shield"
|
|
20
|
-
| "armor"
|
|
21
|
-
| "maxHealth";
|
|
22
|
-
|
|
23
|
-
export type TUnitLocateBuildingGroup =
|
|
24
|
-
| "core"
|
|
25
|
-
| "storage"
|
|
26
|
-
| "generator"
|
|
27
|
-
| "turret"
|
|
28
|
-
| "factory"
|
|
29
|
-
| "repair"
|
|
30
|
-
| "rally"
|
|
31
|
-
| "battery"
|
|
32
|
-
| "reactor";
|
|
1
|
+
export type TRadarFilter =
|
|
2
|
+
| "any"
|
|
3
|
+
| "enemy"
|
|
4
|
+
| "ally"
|
|
5
|
+
| "player"
|
|
6
|
+
| "attacker"
|
|
7
|
+
| "flying"
|
|
8
|
+
| "boss"
|
|
9
|
+
| "ground";
|
|
10
|
+
|
|
11
|
+
export type TRadarFilterArray =
|
|
12
|
+
| [TRadarFilter]
|
|
13
|
+
| [TRadarFilter, TRadarFilter]
|
|
14
|
+
| [TRadarFilter, TRadarFilter, TRadarFilter];
|
|
15
|
+
|
|
16
|
+
export type TRadarSort =
|
|
17
|
+
| "distance"
|
|
18
|
+
| "health"
|
|
19
|
+
| "shield"
|
|
20
|
+
| "armor"
|
|
21
|
+
| "maxHealth";
|
|
22
|
+
|
|
23
|
+
export type TUnitLocateBuildingGroup =
|
|
24
|
+
| "core"
|
|
25
|
+
| "storage"
|
|
26
|
+
| "generator"
|
|
27
|
+
| "turret"
|
|
28
|
+
| "factory"
|
|
29
|
+
| "repair"
|
|
30
|
+
| "rally"
|
|
31
|
+
| "battery"
|
|
32
|
+
| "reactor";
|
package/package.json
CHANGED
|
@@ -1,48 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mlogjs",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Compiler that compiles Javascript to Mindustry Logic Code.",
|
|
5
|
-
"main": "build/index.js",
|
|
6
|
-
"bin": "./build/bin.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "mlogjs",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Compiler that compiles Javascript to Mindustry Logic Code.",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"bin": "./build/bin.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rm -rf docs dist build",
|
|
9
|
+
"build": "tsc && vite build",
|
|
10
|
+
"build:editor": "cd editor && vite build",
|
|
11
|
+
"dev": "ts-node src/bin",
|
|
12
|
+
"dev:editor": "cd editor && vite",
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"coverage": "jest --coverage",
|
|
15
|
+
"docs:doc": "mkdir -p docs && cp -r doc/. docs",
|
|
16
|
+
"docs:lib": "typedoc --out docs/lib lib/*",
|
|
17
|
+
"docs:src": "typedoc --out docs/src src/index.ts",
|
|
18
|
+
"docs": "run-p docs:lib docs:src docs:doc",
|
|
19
|
+
"start": "npm run build && npm i -g . && mlogjs",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
"require": "./build/index.js",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/weisrc/mlogjs.git"
|
|
29
|
+
},
|
|
30
|
+
"packageManager": "yarn@3.2.0",
|
|
31
|
+
"keywords": [],
|
|
32
|
+
"author": "str1z",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/weisrc/mlogjs/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/weisrc/mlogjs#readme",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"acorn": "^8.7.0",
|
|
40
|
+
"cli-highlight": "^2.1.11",
|
|
41
|
+
"yargs": "^17.0.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@monaco-editor/react": "^4.3.1",
|
|
45
|
+
"@types/estree": "^0.0.51",
|
|
46
|
+
"@types/jest": "^27.4.1",
|
|
47
|
+
"@types/node": "^15.3.0",
|
|
48
|
+
"@types/react": "^17.0.39",
|
|
49
|
+
"@types/react-dom": "^17.0.13",
|
|
50
|
+
"@types/react-split-pane": "^0.1.67",
|
|
51
|
+
"@types/yargs": "^16.0.1",
|
|
52
|
+
"@vitejs/plugin-react": "^1.2.0",
|
|
53
|
+
"jest": "^27.5.1",
|
|
54
|
+
"monaco-editor": "^0.32.1",
|
|
55
|
+
"npm-run-all": "^4.1.5",
|
|
56
|
+
"prettier": "^2.5.1",
|
|
57
|
+
"react": "^17.0.2",
|
|
58
|
+
"react-dom": "^17.0.2",
|
|
59
|
+
"react-split-pane": "^0.1.92",
|
|
60
|
+
"ts-jest": "^27.1.3",
|
|
61
|
+
"ts-node": "^10.6.0",
|
|
62
|
+
"typedoc": "^0.22.12",
|
|
63
|
+
"typescript": "^4.6.2",
|
|
64
|
+
"vite": "^2.8.6"
|
|
65
|
+
},
|
|
66
|
+
"files": [
|
|
67
|
+
"build",
|
|
68
|
+
"dist",
|
|
69
|
+
"lib",
|
|
70
|
+
"LICENSE",
|
|
71
|
+
"README.md"
|
|
72
|
+
]
|
|
73
|
+
}
|