mlogjs 0.2.1 → 0.3.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.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/build/Compiler.js +104 -99
- package/build/Compiler.js.map +1 -1
- package/build/CompilerError.js +11 -0
- package/build/CompilerError.js.map +1 -0
- package/build/Scope.js +70 -60
- package/build/Scope.js.map +1 -1
- package/build/bin.js +74 -60
- package/build/bin.js.map +1 -1
- package/build/handlers/BlockStatement.js +13 -13
- package/build/handlers/BlockStatement.js.map +1 -1
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/CallExpression.js.map +1 -1
- package/build/handlers/File.js +9 -0
- package/build/handlers/File.js.map +1 -0
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/ForStatement.js.map +1 -1
- package/build/handlers/Function.js +46 -35
- package/build/handlers/Function.js.map +1 -1
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/IfStatement.js.map +1 -1
- package/build/handlers/Literal.js +14 -17
- package/build/handlers/Literal.js.map +1 -1
- package/build/handlers/Object.js +54 -43
- package/build/handlers/Object.js.map +1 -1
- package/build/handlers/OperationExpressions.js +37 -32
- package/build/handlers/OperationExpressions.js.map +1 -1
- package/build/handlers/Program.js +8 -8
- package/build/handlers/Program.js.map +1 -1
- package/build/handlers/Statements.js +29 -29
- package/build/handlers/Statements.js.map +1 -1
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/TemplateExpression.js.map +1 -1
- package/build/handlers/VariableDeclaration.js +71 -55
- package/build/handlers/VariableDeclaration.js.map +1 -1
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/WhileStatement.js.map +1 -1
- package/build/handlers/index.js +31 -30
- package/build/handlers/index.js.map +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/initScope.js +39 -39
- package/build/instructions/AddressResolver.js +30 -30
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/InstructionBase.js.map +1 -1
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/JumpInstruction.js.map +1 -1
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/OperationInstruction.js.map +1 -1
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/index.js +25 -25
- package/build/macros/Building.js +88 -80
- package/build/macros/Building.js.map +1 -1
- package/build/macros/Function.js +19 -19
- package/build/macros/Function.js.map +1 -1
- package/build/macros/Math.js +61 -56
- package/build/macros/Math.js.map +1 -1
- package/build/macros/Memory.js +62 -60
- package/build/macros/Memory.js.map +1 -1
- package/build/macros/Namespace.js +110 -97
- package/build/macros/Namespace.js.map +1 -1
- package/build/macros/Other.js +20 -19
- package/build/macros/Other.js.map +1 -1
- package/build/macros/RawValue.js +16 -15
- package/build/macros/RawValue.js.map +1 -1
- package/build/macros/commands/Control.js +25 -24
- package/build/macros/commands/Control.js.map +1 -1
- package/build/macros/commands/Draw.js +39 -38
- package/build/macros/commands/Draw.js.map +1 -1
- package/build/macros/commands/DrawFlush.js +17 -16
- package/build/macros/commands/DrawFlush.js.map +1 -1
- package/build/macros/commands/GetLink.js +24 -20
- package/build/macros/commands/GetLink.js.map +1 -1
- package/build/macros/commands/Lookup.js +24 -23
- package/build/macros/commands/Lookup.js.map +1 -1
- package/build/macros/commands/Print.js +17 -13
- package/build/macros/commands/Print.js.map +1 -1
- package/build/macros/commands/PrintFlush.js +17 -16
- package/build/macros/commands/PrintFlush.js.map +1 -1
- package/build/macros/commands/Radar.js +64 -60
- package/build/macros/commands/Radar.js.map +1 -1
- package/build/macros/commands/Sensor.js +20 -19
- package/build/macros/commands/Sensor.js.map +1 -1
- package/build/macros/commands/UnitBind.js +17 -16
- package/build/macros/commands/UnitBind.js.map +1 -1
- package/build/macros/commands/UnitControl.js +72 -67
- package/build/macros/commands/UnitControl.js.map +1 -1
- package/build/macros/commands/UnitLocate.js +75 -54
- package/build/macros/commands/UnitLocate.js.map +1 -1
- package/build/macros/commands/UnitRadar.js +47 -40
- package/build/macros/commands/UnitRadar.js.map +1 -1
- package/build/macros/commands/Wait.js +18 -17
- package/build/macros/commands/Wait.js.map +1 -1
- package/build/macros/commands/index.js +32 -32
- package/build/macros/index.js +39 -39
- package/build/operators.js +101 -101
- package/build/operators.js.map +1 -1
- package/build/types.js +27 -27
- package/build/types.js.map +1 -1
- package/build/utils.js +17 -12
- package/build/utils.js.map +1 -1
- package/build/values/BaseValue.js +111 -111
- package/build/values/BaseValue.js.map +1 -1
- package/build/values/FunctionValue.js +115 -103
- package/build/values/FunctionValue.js.map +1 -1
- package/build/values/LiteralValue.js +88 -87
- package/build/values/LiteralValue.js.map +1 -1
- package/build/values/ObjectValue.js +54 -49
- package/build/values/ObjectValue.js.map +1 -1
- package/build/values/StoreValue.js +31 -30
- package/build/values/StoreValue.js.map +1 -1
- package/build/values/TempValue.js +77 -66
- package/build/values/TempValue.js.map +1 -1
- package/build/values/VoidValue.js +31 -30
- package/build/values/VoidValue.js.map +1 -1
- package/build/values/index.js +22 -22
- package/dist/bin.cjs +82 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/index.cjs +2220 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +2195 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/Compiler.d.ts +26 -0
- package/dist/types/CompilerError.d.ts +9 -0
- package/dist/types/Scope.d.ts +24 -0
- package/dist/types/bin.d.ts +1 -0
- package/dist/types/handlers/BlockStatement.d.ts +2 -0
- package/dist/types/handlers/CallExpression.d.ts +3 -0
- package/dist/types/handlers/File.d.ts +2 -0
- package/dist/types/handlers/ForStatement.d.ts +2 -0
- package/{build → dist/types}/handlers/Function.d.ts +5 -4
- package/{build → dist/types}/handlers/Identifier.d.ts +2 -2
- package/dist/types/handlers/IfStatement.d.ts +2 -0
- package/dist/types/handlers/Literal.d.ts +5 -0
- package/{build → dist/types}/handlers/Object.d.ts +6 -4
- package/{build → dist/types}/handlers/OperationExpressions.d.ts +8 -7
- package/dist/types/handlers/Program.d.ts +2 -0
- package/dist/types/handlers/Statements.d.ts +5 -0
- package/dist/types/handlers/TemplateExpression.d.ts +2 -0
- package/dist/types/handlers/Typescript.d.ts +7 -0
- package/dist/types/handlers/VariableDeclaration.d.ts +3 -0
- package/dist/types/handlers/WhileStatement.d.ts +3 -0
- package/{build → dist/types}/handlers/index.d.ts +16 -14
- package/dist/types/index.d.ts +2 -0
- package/{build → dist/types}/initScope.d.ts +5 -2
- package/{build → dist/types}/instructions/AddressResolver.d.ts +12 -12
- package/{build → dist/types}/instructions/ControlInstructions.d.ts +8 -11
- package/{build → dist/types}/instructions/EndInstruction.d.ts +4 -4
- package/{build → dist/types}/instructions/InstructionBase.d.ts +10 -10
- package/{build → dist/types}/instructions/JumpInstruction.d.ts +15 -15
- package/{build → dist/types}/instructions/OperationInstruction.d.ts +5 -5
- package/{build → dist/types}/instructions/SetCounterInstruction.d.ts +5 -5
- package/{build → dist/types}/instructions/SetInstruction.d.ts +6 -5
- package/{build → dist/types}/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/{build → dist/types}/instructions/index.d.ts +9 -9
- package/{build → dist/types}/macros/Building.d.ts +10 -11
- package/dist/types/macros/Entities.d.ts +11 -0
- package/dist/types/macros/Function.d.ts +13 -0
- package/dist/types/macros/GetGlobal.d.ts +5 -0
- package/{build → dist/types}/macros/Math.d.ts +5 -5
- package/{build → dist/types}/macros/Memory.d.ts +5 -5
- package/{build → dist/types}/macros/Namespace.d.ts +16 -21
- package/{build → dist/types}/macros/Other.d.ts +5 -5
- package/{build → dist/types}/macros/RawValue.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Control.d.ts +5 -5
- package/dist/types/macros/commands/Draw.d.ts +5 -0
- package/{build → dist/types}/macros/commands/DrawFlush.d.ts +5 -5
- package/{build/macros/commands/Draw.d.ts → dist/types/macros/commands/End.d.ts} +5 -5
- package/{build → dist/types}/macros/commands/GetLink.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Lookup.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Print.d.ts +5 -5
- package/{build → dist/types}/macros/commands/PrintFlush.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Radar.d.ts +7 -7
- package/{build → dist/types}/macros/commands/Sensor.d.ts +5 -5
- package/{build → dist/types}/macros/commands/UnitBind.d.ts +5 -5
- package/dist/types/macros/commands/UnitControl.d.ts +5 -0
- package/{build → dist/types}/macros/commands/UnitLocate.d.ts +5 -5
- package/{build → dist/types}/macros/commands/UnitRadar.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Wait.d.ts +5 -5
- package/{build → dist/types}/macros/commands/index.d.ts +15 -14
- package/{build → dist/types}/macros/index.d.ts +6 -7
- package/{build → dist/types}/operators.d.ts +25 -25
- package/dist/types/types.d.ts +224 -0
- package/dist/types/utils.d.ts +30 -0
- package/dist/types/values/BaseValue.d.ts +7 -0
- package/dist/types/values/DestructuringValue.d.ts +17 -0
- package/dist/types/values/FunctionValue.d.ts +47 -0
- package/{build → dist/types}/values/LiteralValue.d.ts +13 -12
- package/dist/types/values/ObjectValue.d.ts +23 -0
- package/dist/types/values/SenseableValue.d.ts +23 -0
- package/dist/types/values/StackValue.d.ts +16 -0
- package/dist/types/values/StoreValue.d.ts +15 -0
- package/{build → dist/types}/values/TempValue.d.ts +19 -12
- package/dist/types/values/ValueOwner.d.ts +27 -0
- package/dist/types/values/VoidValue.d.ts +16 -0
- package/{build → dist/types}/values/index.d.ts +7 -6
- package/lib/commands.d.ts +242 -36
- package/lib/eslib/lib.es5.d.ts +1 -1
- package/lib/globals.d.ts +172 -159
- package/lib/helpers.d.ts +2 -2
- package/lib/memory.d.ts +1 -1
- package/lib/traits.d.ts +130 -110
- package/package.json +33 -38
- package/build/Compiler.d.ts +0 -18
- package/build/Scope.d.ts +0 -26
- package/build/bin.d.ts +0 -2
- package/build/handlers/BlockStatement.d.ts +0 -2
- package/build/handlers/CallExpression.d.ts +0 -3
- package/build/handlers/ForStatement.d.ts +0 -2
- package/build/handlers/IfStatement.d.ts +0 -2
- package/build/handlers/Literal.d.ts +0 -2
- package/build/handlers/Program.d.ts +0 -2
- package/build/handlers/Statements.d.ts +0 -5
- package/build/handlers/TemplateExpression.d.ts +0 -2
- package/build/handlers/VariableDeclaration.d.ts +0 -3
- package/build/handlers/WhileStatement.d.ts +0 -2
- package/build/index.d.ts +0 -1
- package/build/macros/Function.d.ts +0 -12
- package/build/macros/commands/UnitControl.d.ts +0 -5
- package/build/types.d.ts +0 -49
- package/build/utils.d.ts +0 -3
- package/build/values/BaseValue.d.ts +0 -5
- package/build/values/FunctionValue.d.ts +0 -34
- package/build/values/ObjectValue.d.ts +0 -17
- package/build/values/StoreValue.d.ts +0 -11
- package/build/values/VoidValue.d.ts +0 -11
- package/dist/mlogjs.es.js +0 -6366
- package/dist/mlogjs.umd.js +0 -8
|
@@ -1,17 +1,18 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
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
|
+
const CompilerError_1 = require("../../CompilerError");
|
|
8
|
+
class DrawFlush extends __1.MacroFunction {
|
|
9
|
+
constructor(scope) {
|
|
10
|
+
super(scope, (target) => {
|
|
11
|
+
if (!(target instanceof values_1.ObjectValue))
|
|
12
|
+
throw new CompilerError_1.CompilerError("The drawflush target must be a building");
|
|
13
|
+
return [null, [new instructions_1.InstructionBase("drawflush", target)]];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DrawFlush = DrawFlush;
|
|
17
18
|
//# sourceMappingURL=DrawFlush.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawFlush.js","sourceRoot":"","sources":["../../../src/macros/commands/DrawFlush.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"DrawFlush.js","sourceRoot":"","sources":["../../../src/macros/commands/DrawFlush.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAA2C;AAC3C,uDAAoD;AAEpD,MAAa,SAAU,SAAQ,iBAAmB;IAChD,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,MAAc,EAAE,EAAE;YAC9B,IAAI,CAAC,CAAC,MAAM,YAAY,oBAAW,CAAC;gBAClC,MAAM,IAAI,6BAAa,CAAC,yCAAyC,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AARD,8BAQC"}
|
|
@@ -1,21 +1,25 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const outBuild = new Building_1.Building(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
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
|
+
const CompilerError_1 = require("../../CompilerError");
|
|
9
|
+
class GetLink extends __1.MacroFunction {
|
|
10
|
+
constructor(scope) {
|
|
11
|
+
super(scope, (index) => {
|
|
12
|
+
if (!(index instanceof values_1.StoreValue) &&
|
|
13
|
+
(!(index instanceof values_1.LiteralValue) || typeof index.data !== "number"))
|
|
14
|
+
throw new CompilerError_1.CompilerError("The getlink index must be a number literal or a store");
|
|
15
|
+
const outBuild = new Building_1.Building({
|
|
16
|
+
scope,
|
|
17
|
+
name: scope.makeTempName(),
|
|
18
|
+
renameable: true,
|
|
19
|
+
});
|
|
20
|
+
return [outBuild, [new instructions_1.InstructionBase("getlink", outBuild, index)]];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.GetLink = GetLink;
|
|
21
25
|
//# sourceMappingURL=GetLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetLink.js","sourceRoot":"","sources":["../../../src/macros/commands/GetLink.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"GetLink.js","sourceRoot":"","sources":["../../../src/macros/commands/GetLink.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAwD;AACxD,0CAAuC;AACvC,uDAAoD;AAEpD,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,6BAAa,CACrB,uDAAuD,CACxD,CAAC;YACJ,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC;gBAC5B,KAAK;gBACL,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE;gBAC1B,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;YACH,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,8BAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlBD,0BAkBC"}
|
|
@@ -1,24 +1,25 @@
|
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
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 CompilerError_1 = require("../../CompilerError");
|
|
8
|
+
const validKinds = ["block", "unit", "item", "liquid"];
|
|
9
|
+
class Lookup extends __1.MacroFunction {
|
|
10
|
+
constructor(scope) {
|
|
11
|
+
super(scope, (kind, index) => {
|
|
12
|
+
if (!(kind instanceof values_1.LiteralValue && typeof kind.data === "string"))
|
|
13
|
+
throw new CompilerError_1.CompilerError("The lookup kind must be a string literal");
|
|
14
|
+
if (!validKinds.includes(kind.data))
|
|
15
|
+
throw new CompilerError_1.CompilerError("Invalid lookup kind");
|
|
16
|
+
if (!(index instanceof values_1.LiteralValue && typeof index.data === "number") &&
|
|
17
|
+
!(index instanceof values_1.StoreValue))
|
|
18
|
+
throw new CompilerError_1.CompilerError("The lookup index must be a number literal or a store");
|
|
19
|
+
const temp = new values_1.TempValue({ scope });
|
|
20
|
+
return [temp, [new instructions_1.InstructionBase("lookup", kind.data, temp, index)]];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Lookup = Lookup;
|
|
24
25
|
//# sourceMappingURL=Lookup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lookup.js","sourceRoot":"","sources":["../../../src/macros/commands/Lookup.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAmE;
|
|
1
|
+
{"version":3,"file":"Lookup.js","sourceRoot":"","sources":["../../../src/macros/commands/Lookup.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAmE;AACnE,uDAAoD;AAEpD,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,6BAAa,CAAC,0CAA0C,CAAC,CAAC;YAEtE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBACjC,MAAM,IAAI,6BAAa,CAAC,qBAAqB,CAAC,CAAC;YAEjD,IACE,CAAC,CAAC,KAAK,YAAY,qBAAY,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAClE,CAAC,CAAC,KAAK,YAAY,mBAAU,CAAC;gBAE9B,MAAM,IAAI,6BAAa,CACrB,sDAAsD,CACvD,CAAC;YAEJ,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACtC,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;AArBD,wBAqBC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
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
|
+
const inst = [];
|
|
10
|
+
for (const value of values) {
|
|
11
|
+
inst.push(new instructions_1.InstructionBase("print", value));
|
|
12
|
+
}
|
|
13
|
+
return [null, inst];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.Print = Print;
|
|
14
18
|
//# sourceMappingURL=Print.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Print.js","sourceRoot":"","sources":["../../../src/macros/commands/Print.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAGnC,MAAa,KAAM,SAAQ,
|
|
1
|
+
{"version":3,"file":"Print.js","sourceRoot":"","sources":["../../../src/macros/commands/Print.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAGnC,MAAa,KAAM,SAAQ,iBAAmB;IAC5C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,MAAgB,EAAE,EAAE;YACnC,MAAM,IAAI,GAAmB,EAAE,CAAC;YAEhC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,8BAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;aAChD;YAED,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAZD,sBAYC"}
|
|
@@ -1,17 +1,18 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
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
|
+
const CompilerError_1 = require("../../CompilerError");
|
|
8
|
+
class PrintFlush extends __1.MacroFunction {
|
|
9
|
+
constructor(scope) {
|
|
10
|
+
super(scope, (target) => {
|
|
11
|
+
if (!(target instanceof values_1.ObjectValue))
|
|
12
|
+
throw new CompilerError_1.CompilerError("The printflush target must be a building");
|
|
13
|
+
return [null, [new instructions_1.InstructionBase("printflush", target)]];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.PrintFlush = PrintFlush;
|
|
17
18
|
//# sourceMappingURL=PrintFlush.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrintFlush.js","sourceRoot":"","sources":["../../../src/macros/commands/PrintFlush.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"PrintFlush.js","sourceRoot":"","sources":["../../../src/macros/commands/PrintFlush.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAA2C;AAC3C,uDAAoD;AAEpD,MAAa,UAAW,SAAQ,iBAAmB;IACjD,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,MAAc,EAAE,EAAE;YAC9B,IAAI,CAAC,CAAC,MAAM,YAAY,oBAAW,CAAC;gBAClC,MAAM,IAAI,6BAAa,CAAC,0CAA0C,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AARD,gCAQC"}
|
|
@@ -1,61 +1,65 @@
|
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
+
const CompilerError_1 = require("../../CompilerError");
|
|
9
|
+
exports.validRadarFilters = [
|
|
10
|
+
"any",
|
|
11
|
+
"enemy",
|
|
12
|
+
"ally",
|
|
13
|
+
"player",
|
|
14
|
+
"attacker",
|
|
15
|
+
"flying",
|
|
16
|
+
"boss",
|
|
17
|
+
"ground",
|
|
18
|
+
];
|
|
19
|
+
exports.validRadarSorts = [
|
|
20
|
+
"distance",
|
|
21
|
+
"health",
|
|
22
|
+
"shield",
|
|
23
|
+
"armor",
|
|
24
|
+
"maxHealth",
|
|
25
|
+
];
|
|
26
|
+
class Radar extends __1.MacroFunction {
|
|
27
|
+
constructor(scope) {
|
|
28
|
+
super(scope, (building, filter1, filter2, filter3, order, sort) => {
|
|
29
|
+
if (!(building instanceof values_1.ObjectValue))
|
|
30
|
+
throw new CompilerError_1.CompilerError("The building must a store");
|
|
31
|
+
if (!(filter1 instanceof values_1.LiteralValue) ||
|
|
32
|
+
typeof filter1.data !== "string" ||
|
|
33
|
+
!(filter2 instanceof values_1.LiteralValue) ||
|
|
34
|
+
typeof filter2.data !== "string" ||
|
|
35
|
+
!(filter3 instanceof values_1.LiteralValue) ||
|
|
36
|
+
typeof filter3.data !== "string")
|
|
37
|
+
throw new CompilerError_1.CompilerError("The filters must be string literals");
|
|
38
|
+
if (!exports.validRadarFilters.includes(filter1.data))
|
|
39
|
+
throw new CompilerError_1.CompilerError("Invalid value for filter1");
|
|
40
|
+
if (!exports.validRadarFilters.includes(filter2.data))
|
|
41
|
+
throw new CompilerError_1.CompilerError("Invalid value for filter2");
|
|
42
|
+
if (!exports.validRadarFilters.includes(filter3.data))
|
|
43
|
+
throw new CompilerError_1.CompilerError("Invalid value for filter3");
|
|
44
|
+
if (!(order instanceof values_1.LiteralValue || order instanceof values_1.StoreValue))
|
|
45
|
+
throw new CompilerError_1.CompilerError("The radar order must be a literal or a store");
|
|
46
|
+
if (!(sort instanceof values_1.LiteralValue) || typeof sort.data !== "string")
|
|
47
|
+
throw new CompilerError_1.CompilerError("The radar sort must be a string literal");
|
|
48
|
+
if (!exports.validRadarSorts.includes(sort.data))
|
|
49
|
+
throw new CompilerError_1.CompilerError("Invalid sort value");
|
|
50
|
+
const outUnit = new Namespace_1.Unit({
|
|
51
|
+
scope,
|
|
52
|
+
name: scope.makeTempName(),
|
|
53
|
+
renameable: true,
|
|
54
|
+
});
|
|
55
|
+
return [
|
|
56
|
+
outUnit,
|
|
57
|
+
[
|
|
58
|
+
new instructions_1.InstructionBase("radar", filter1.data, filter2.data, filter3.data, sort.data, building, order, outUnit),
|
|
59
|
+
],
|
|
60
|
+
];
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.Radar = Radar;
|
|
61
65
|
//# sourceMappingURL=Radar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radar.js","sourceRoot":"","sources":["../../../src/macros/commands/Radar.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"Radar.js","sourceRoot":"","sources":["../../../src/macros/commands/Radar.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAqE;AACrE,4CAAoC;AACpC,uDAAoD;AAEvC,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,6BAAa,CAAC,2BAA2B,CAAC,CAAC;YAEvD,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,6BAAa,CAAC,qCAAqC,CAAC,CAAC;YAEjE,IAAI,CAAC,yBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC3C,MAAM,IAAI,6BAAa,CAAC,2BAA2B,CAAC,CAAC;YACvD,IAAI,CAAC,yBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC3C,MAAM,IAAI,6BAAa,CAAC,2BAA2B,CAAC,CAAC;YACvD,IAAI,CAAC,yBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC3C,MAAM,IAAI,6BAAa,CAAC,2BAA2B,CAAC,CAAC;YAEvD,IAAI,CAAC,CAAC,KAAK,YAAY,qBAAY,IAAI,KAAK,YAAY,mBAAU,CAAC;gBACjE,MAAM,IAAI,6BAAa,CAAC,8CAA8C,CAAC,CAAC;YAE1E,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;gBAClE,MAAM,IAAI,6BAAa,CAAC,yCAAyC,CAAC,CAAC;YAErE,IAAI,CAAC,uBAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBACtC,MAAM,IAAI,6BAAa,CAAC,oBAAoB,CAAC,CAAC;YAEhD,MAAM,OAAO,GAAG,IAAI,gBAAI,CAAC;gBACvB,KAAK;gBACL,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE;gBAC1B,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;YACH,OAAO;gBACL,OAAO;gBACP;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,OAAO,CACR;iBACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtDD,sBAsDC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
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
|
+
const CompilerError_1 = require("../../CompilerError");
|
|
8
|
+
class Sensor extends __1.MacroFunction {
|
|
9
|
+
constructor(scope) {
|
|
10
|
+
super(scope, (property, target) => {
|
|
11
|
+
if (!(property instanceof values_1.StoreValue))
|
|
12
|
+
throw new CompilerError_1.CompilerError("The sensor property must be a store");
|
|
13
|
+
if (!(target instanceof values_1.ObjectValue))
|
|
14
|
+
throw new CompilerError_1.CompilerError("The sensor target must be a store");
|
|
15
|
+
const temp = new values_1.TempValue({ scope });
|
|
16
|
+
return [temp, [new instructions_1.InstructionBase("sensor", temp, property, target)]];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Sensor = Sensor;
|
|
20
21
|
//# sourceMappingURL=Sensor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sensor.js","sourceRoot":"","sources":["../../../src/macros/commands/Sensor.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAkE;
|
|
1
|
+
{"version":3,"file":"Sensor.js","sourceRoot":"","sources":["../../../src/macros/commands/Sensor.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAkE;AAClE,uDAAoD;AAEpD,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,6BAAa,CAAC,qCAAqC,CAAC,CAAC;YAEjE,IAAI,CAAC,CAAC,MAAM,YAAY,oBAAW,CAAC;gBAClC,MAAM,IAAI,6BAAa,CAAC,mCAAmC,CAAC,CAAC;YAE/D,MAAM,IAAI,GAAG,IAAI,kBAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACtC,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"}
|
|
@@ -1,17 +1,18 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
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
|
+
const CompilerError_1 = require("../../CompilerError");
|
|
8
|
+
class UnitBind extends __1.MacroFunction {
|
|
9
|
+
constructor(scope) {
|
|
10
|
+
super(scope, type => {
|
|
11
|
+
if (!(type instanceof values_1.StoreValue))
|
|
12
|
+
throw new CompilerError_1.CompilerError("The unitBind type must be a store");
|
|
13
|
+
return [null, [new instructions_1.InstructionBase("ubind", type)]];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.UnitBind = UnitBind;
|
|
17
18
|
//# sourceMappingURL=UnitBind.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitBind.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitBind.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"UnitBind.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitBind.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAA0C;AAC1C,uDAAoD;AAEpD,MAAa,QAAS,SAAQ,iBAAmB;IAC/C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YAClB,IAAI,CAAC,CAAC,IAAI,YAAY,mBAAU,CAAC;gBAC/B,MAAM,IAAI,6BAAa,CAAC,mCAAmC,CAAC,CAAC;YAE/D,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AATD,4BASC"}
|
|
@@ -1,68 +1,73 @@
|
|
|
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
|
|
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
|
-
value instanceof values_1.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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 CompilerError_1 = require("../../CompilerError");
|
|
9
|
+
const validModes = [
|
|
10
|
+
"idle",
|
|
11
|
+
"stop",
|
|
12
|
+
"move",
|
|
13
|
+
"approach",
|
|
14
|
+
"boost",
|
|
15
|
+
"pathfind",
|
|
16
|
+
"target",
|
|
17
|
+
"targetp",
|
|
18
|
+
"itemDrop",
|
|
19
|
+
"itemTake",
|
|
20
|
+
"payDrop",
|
|
21
|
+
"payTake",
|
|
22
|
+
"payEnter",
|
|
23
|
+
"mine",
|
|
24
|
+
"flag",
|
|
25
|
+
"build",
|
|
26
|
+
"getBlock",
|
|
27
|
+
"within",
|
|
28
|
+
];
|
|
29
|
+
class UnitControl extends __1.MacroFunction {
|
|
30
|
+
constructor(scope) {
|
|
31
|
+
super(scope, (mode, ...args) => {
|
|
32
|
+
if (!(mode instanceof values_1.LiteralValue) || typeof mode.data !== "string")
|
|
33
|
+
throw new CompilerError_1.CompilerError("The unitControl mode must be a string literal");
|
|
34
|
+
if (!validModes.includes(mode.data))
|
|
35
|
+
throw new CompilerError_1.CompilerError("Invalid unitControl mode");
|
|
36
|
+
if (args.some(value => !(value instanceof values_1.StoreValue ||
|
|
37
|
+
value instanceof values_1.LiteralValue ||
|
|
38
|
+
value instanceof values_1.ObjectValue)))
|
|
39
|
+
throw new CompilerError_1.CompilerError("The others arguments of unitControl must be literals or stores");
|
|
40
|
+
let result = null;
|
|
41
|
+
let extraArgs = [];
|
|
42
|
+
switch (mode.data) {
|
|
43
|
+
case "getBlock": {
|
|
44
|
+
const outType = new values_1.TempValue({ scope });
|
|
45
|
+
const outBuilding = new Building_1.Building({
|
|
46
|
+
scope,
|
|
47
|
+
name: scope.makeTempName(),
|
|
48
|
+
renameable: true,
|
|
49
|
+
});
|
|
50
|
+
result = new values_1.ObjectValue(scope, {
|
|
51
|
+
0: outType,
|
|
52
|
+
1: outBuilding,
|
|
53
|
+
length: new values_1.LiteralValue(scope, 2),
|
|
54
|
+
});
|
|
55
|
+
extraArgs = [outType, outBuilding, new values_1.LiteralValue(scope, 0)];
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "within": {
|
|
59
|
+
const temp = new values_1.TempValue({ scope });
|
|
60
|
+
result = temp;
|
|
61
|
+
extraArgs = [temp, new values_1.LiteralValue(scope, 0)];
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return [
|
|
66
|
+
result,
|
|
67
|
+
[new instructions_1.InstructionBase("ucontrol", mode.data, ...args, ...extraArgs)],
|
|
68
|
+
];
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.UnitControl = UnitControl;
|
|
68
73
|
//# sourceMappingURL=UnitControl.js.map
|