mlogjs 0.5.1 → 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.
- package/README.md +2 -2
- package/dist/{index.cjs → Compiler-7GMG4MDr.js} +1746 -452
- package/dist/Compiler.d.ts +8 -12
- package/dist/CompilerError.d.ts +13 -3
- package/dist/Scope.d.ts +8 -8
- package/dist/bin/files.d.ts +18 -0
- package/dist/bin.mjs +170 -0
- package/dist/handlers/Import.d.ts +5 -0
- package/dist/handlers/Literal.d.ts +2 -2
- package/dist/handlers/Typescript.d.ts +2 -2
- package/dist/handlers/index.d.ts +1 -0
- package/dist/index.mjs +3 -4267
- package/dist/instructions/AddressResolver.d.ts +4 -4
- package/dist/instructions/ControlInstructions.d.ts +3 -3
- package/dist/instructions/InstructionBase.d.ts +1 -0
- package/dist/instructions/JumpInstruction.d.ts +5 -5
- package/dist/instructions/index.d.ts +0 -1
- package/dist/macros/DynamicArray.d.ts +4 -4
- package/dist/macros/Function.d.ts +2 -2
- package/dist/macros/GetBuildings.d.ts +4 -0
- package/dist/macros/GetColor.d.ts +4 -0
- package/dist/macros/Marker.d.ts +4 -0
- package/dist/macros/Namespace.d.ts +16 -0
- package/dist/macros/Queries.d.ts +10 -0
- package/dist/macros/StringView.d.ts +4 -0
- package/dist/macros/commands/Effect.d.ts +4 -0
- package/dist/macros/commands/Format.d.ts +4 -0
- package/dist/macros/commands/LocalePrint.d.ts +4 -0
- package/dist/macros/commands/PlayMusic.d.ts +4 -0
- package/dist/macros/commands/PlaySound.d.ts +4 -0
- package/dist/macros/commands/PrintChar.d.ts +4 -0
- package/dist/macros/commands/Query.d.ts +4 -0
- package/dist/macros/commands/SetProp.d.ts +4 -0
- package/dist/macros/commands/SpawnBullet.d.ts +4 -0
- package/dist/macros/commands/Sync.d.ts +6 -0
- package/dist/macros/commands/UnpackColor.d.ts +4 -0
- package/dist/macros/commands/WeatherSense.d.ts +4 -0
- package/dist/macros/commands/WeatherSet.d.ts +4 -0
- package/dist/macros/commands/index.d.ts +13 -0
- package/dist/macros/index.d.ts +7 -1
- package/dist/macros/util.d.ts +5 -2
- package/dist/modules.d.ts +8 -0
- package/dist/operators.d.ts +1 -1
- package/dist/types.d.ts +84 -59
- package/dist/utils/constants.d.ts +9 -4
- package/dist/utils/general.d.ts +8 -9
- package/dist/utils/instruction.d.ts +5 -1
- package/dist/utils/value.d.ts +14 -5
- package/dist/values/AssignmentValue.d.ts +1 -1
- package/dist/values/BaseValue.d.ts +4 -2
- package/dist/values/DestructuringValue.d.ts +5 -7
- package/dist/values/FunctionValue.d.ts +8 -6
- package/dist/values/JumpOutValue.d.ts +4 -4
- package/dist/values/LazyValue.d.ts +3 -3
- package/dist/values/LiteralValue.d.ts +2 -3
- package/dist/values/ObjectValue.d.ts +6 -11
- package/dist/values/StoreValue.d.ts +10 -5
- package/dist/values/VoidValue.d.ts +2 -1
- package/dist/values/index.d.ts +0 -1
- package/lib/commands.d.ts +777 -729
- package/lib/eslib/lib.es2015.collection.d.ts +50 -39
- package/lib/eslib/lib.es2015.core.d.ts +59 -0
- package/lib/eslib/lib.es2015.d.ts +0 -3
- package/lib/eslib/lib.es2015.generator.d.ts +54 -53
- package/lib/eslib/lib.es2015.iterable.d.ts +9 -6
- package/lib/eslib/lib.es5.d.ts +53 -6
- package/lib/globals.d.ts +309 -18
- package/lib/helpers.d.ts +86 -52
- package/lib/kinds.d.ts +42 -7
- package/lib/macros.d.ts +53 -18
- package/lib/traits.d.ts +308 -146
- package/lib/util.d.ts +144 -48
- package/lib/world.d.ts +1197 -0
- package/package.json +27 -35
- package/dist/bin.cjs +0 -111
- package/dist/initScope.d.ts +0 -5
- package/dist/instructions/ZeroSpaceInstruction.d.ts +0 -4
- package/dist/values/SenseableValue.d.ts +0 -24
- /package/dist/{bin.d.ts → bin/index.d.ts} +0 -0
package/lib/world.d.ts
ADDED
|
@@ -0,0 +1,1197 @@
|
|
|
1
|
+
/// <reference path="./util.d.ts" />
|
|
2
|
+
/// <reference path="./globals.d.ts" />
|
|
3
|
+
|
|
4
|
+
declare module "mlogjs:world" {
|
|
5
|
+
import {
|
|
6
|
+
SettableBuilding,
|
|
7
|
+
SettableBullet,
|
|
8
|
+
SettableUnit,
|
|
9
|
+
TPermanentStatusEffect,
|
|
10
|
+
TStatusEffect,
|
|
11
|
+
} from "mlogjs:types";
|
|
12
|
+
|
|
13
|
+
interface QueriesView {
|
|
14
|
+
readonly length: number;
|
|
15
|
+
readonly value: unknown;
|
|
16
|
+
readonly [index: number]: AnyUnit | BasicBuilding | undefined;
|
|
17
|
+
at(index: number): AnyUnit | BasicBuilding | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// privileged global variables
|
|
21
|
+
interface PVars {
|
|
22
|
+
readonly server: boolean;
|
|
23
|
+
readonly client: boolean;
|
|
24
|
+
readonly clientLocale: string;
|
|
25
|
+
readonly clientUnit: AnyUnit;
|
|
26
|
+
readonly clientName: string;
|
|
27
|
+
readonly clientTeam: number;
|
|
28
|
+
readonly clientMobile: boolean;
|
|
29
|
+
readonly clientMusicPlaying: boolean;
|
|
30
|
+
readonly clientCurrentMusic?: string;
|
|
31
|
+
readonly queries: QueriesView;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export var PVars: PVars;
|
|
35
|
+
|
|
36
|
+
/** Gets block data from the map. */
|
|
37
|
+
export namespace getBlock {
|
|
38
|
+
/**
|
|
39
|
+
* Gets the floor type on the given location
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* const floorType = getBlock.floor(10, 20);
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
function floor(x: number, y: number): EnvBlockSymbol;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Gets the ore type on the given location. `Blocks.air` if there is no ore
|
|
49
|
+
*
|
|
50
|
+
* ```js
|
|
51
|
+
* const oreType = getBlock.ore(10, 20);
|
|
52
|
+
*
|
|
53
|
+
* if (oreType != Blocks.air) {
|
|
54
|
+
* print("found ", oreType);
|
|
55
|
+
* } else {
|
|
56
|
+
* print("no ore found");
|
|
57
|
+
* }
|
|
58
|
+
* printFlush();
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
function ore(x: number, y: number): OreSymbol | typeof Blocks.air;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Gets the block type on the give location. `Blocks.air` if there is no
|
|
65
|
+
* block.
|
|
66
|
+
*
|
|
67
|
+
* ```js
|
|
68
|
+
* const blockType = getBlock.block(10, 20);
|
|
69
|
+
*
|
|
70
|
+
* if (blockType != Blocks.air) {
|
|
71
|
+
* print("found ", blockType);
|
|
72
|
+
* } else {
|
|
73
|
+
* print("no block found");
|
|
74
|
+
* }
|
|
75
|
+
* printFlush();
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
function block(x: number, y: number): BlockSymbol;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Gets the building on the given location. `undefined` if there is no
|
|
82
|
+
* building.
|
|
83
|
+
*
|
|
84
|
+
* ```js
|
|
85
|
+
* const building = getBlock.building(10, 20);
|
|
86
|
+
*
|
|
87
|
+
* if (building != undefined) {
|
|
88
|
+
* print("found ", building, "");
|
|
89
|
+
* } else {
|
|
90
|
+
* print("no building found");
|
|
91
|
+
* }
|
|
92
|
+
* printFlush();
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
function building<T extends BasicBuilding = AnyBuilding>(
|
|
96
|
+
x: number,
|
|
97
|
+
y: number,
|
|
98
|
+
): T | undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Sets block data on a given location. */
|
|
102
|
+
export namespace setBlock {
|
|
103
|
+
// TODO: maybe have a separate floor symbol type?
|
|
104
|
+
/**
|
|
105
|
+
* Sets the floor of the tile at the given location.
|
|
106
|
+
*
|
|
107
|
+
* ```js
|
|
108
|
+
* setBlock.floor(10, 20, Blocks.metalFloor5);
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
function floor(x: number, y: number, to: EnvBlockSymbol): void;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Sets the ore at the given location. Use `Blocks.air` to remove any ore.
|
|
115
|
+
*
|
|
116
|
+
* ```js
|
|
117
|
+
* setBlock.ore(10, 20, Blocks.oreCopper);
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
function ore(x: number, y: number, to: OreSymbol | typeof Blocks.air): void;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Sets the block at a given location, it can be a regular building or an
|
|
124
|
+
* environment block.
|
|
125
|
+
*
|
|
126
|
+
* ```js
|
|
127
|
+
* setBlock.block({
|
|
128
|
+
* x: 10,
|
|
129
|
+
* y: 20,
|
|
130
|
+
* to: Blocks.router,
|
|
131
|
+
* rotation: 0,
|
|
132
|
+
* team: Teams.sharded,
|
|
133
|
+
* });
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
function block(options: {
|
|
137
|
+
x: number;
|
|
138
|
+
y: number;
|
|
139
|
+
to: EnvBlockSymbol | BuildingSymbol;
|
|
140
|
+
team: TeamIdentifier;
|
|
141
|
+
rotation: number;
|
|
142
|
+
}): void;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Spawns an unit at the given location.
|
|
147
|
+
*
|
|
148
|
+
* @param options.rotation The initial rotation of the unit in degrees.
|
|
149
|
+
*
|
|
150
|
+
* ```js
|
|
151
|
+
* spawnUnit({
|
|
152
|
+
* team: Teams.sharded,
|
|
153
|
+
* type: Units.flare,
|
|
154
|
+
* x: 10,
|
|
155
|
+
* y: 20,
|
|
156
|
+
* rotation: 90,
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export function spawnUnit<T extends BasicUnit = AnyUnit>(options: {
|
|
161
|
+
type: UnitSymbol;
|
|
162
|
+
x: number;
|
|
163
|
+
y: number;
|
|
164
|
+
team: TeamIdentifier;
|
|
165
|
+
/** The initial rotation of the unit in degrees. */
|
|
166
|
+
rotation?: number;
|
|
167
|
+
/** Whether the spawn effect should be displayed. Defaults to `true`. */
|
|
168
|
+
effect?: boolean;
|
|
169
|
+
}): T;
|
|
170
|
+
|
|
171
|
+
export function spawnBullet(options: {
|
|
172
|
+
from: BasicBuilding | AnyUnit | BlockSymbol | UnitSymbol;
|
|
173
|
+
x: number;
|
|
174
|
+
y: number;
|
|
175
|
+
rotation: number;
|
|
176
|
+
team: TeamIdentifier;
|
|
177
|
+
index?: number;
|
|
178
|
+
owner?: AnyUnit | BasicBuilding;
|
|
179
|
+
damage?: number;
|
|
180
|
+
velocityScl?: number;
|
|
181
|
+
lifeScl?: number;
|
|
182
|
+
aimX?: number;
|
|
183
|
+
aimY?: number;
|
|
184
|
+
}): Bullet;
|
|
185
|
+
|
|
186
|
+
export function senseWeather(weather: WeatherSymbol): boolean;
|
|
187
|
+
|
|
188
|
+
export function setWeather(weather: WeatherSymbol, state: boolean): void;
|
|
189
|
+
|
|
190
|
+
/** Contains the variants for the `applyStatus` instruction. */
|
|
191
|
+
export namespace applyStatus {
|
|
192
|
+
/**
|
|
193
|
+
* Applies a status effect to the given unit.
|
|
194
|
+
*
|
|
195
|
+
* The only status effects that don't require a duration are `overdrive` and
|
|
196
|
+
* `boss`.
|
|
197
|
+
*
|
|
198
|
+
* ```js
|
|
199
|
+
* applyStatus.apply("burning", Vars.unit, 10);
|
|
200
|
+
* applyStatus.apply("boss", Vars.unit);
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
function apply(
|
|
204
|
+
status:
|
|
205
|
+
| Exclude<TStatusEffect, TPermanentStatusEffect>
|
|
206
|
+
| StatusEffectSymbol
|
|
207
|
+
| symbol,
|
|
208
|
+
unit: BasicUnit,
|
|
209
|
+
duration?: number,
|
|
210
|
+
): void;
|
|
211
|
+
|
|
212
|
+
function apply(status: TPermanentStatusEffect, unit: BasicUnit): void;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Removes a status effect to the given unit.
|
|
216
|
+
*
|
|
217
|
+
* ```js
|
|
218
|
+
* applyStatus.clear("burning", Vars.unit);
|
|
219
|
+
* applyStatus.clear("boss", Vars.unit);
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
function clear(
|
|
223
|
+
status: TStatusEffect | StatusEffectSymbol | symbol,
|
|
224
|
+
unit: BasicUnit,
|
|
225
|
+
): void;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Spawns an enemy wave, can be used even if there is an already active wave.
|
|
230
|
+
*
|
|
231
|
+
* ```js
|
|
232
|
+
* // natural wave, units appear on the enemy spawn
|
|
233
|
+
* spawnWave(true);
|
|
234
|
+
*
|
|
235
|
+
* // syntethic wave, units appear on the given coordinates
|
|
236
|
+
* spawnWave(false, 10, 20);
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
export function spawnWave(natural: true): void;
|
|
240
|
+
export function spawnWave(natural: false, x: number, y: number): void;
|
|
241
|
+
export function spawnWave(natural: boolean, x?: number, y?: number): void;
|
|
242
|
+
|
|
243
|
+
/** Contains the multiple variants of the `set rule` instruction. */
|
|
244
|
+
export namespace setRule {
|
|
245
|
+
/**
|
|
246
|
+
* Sets the wave countdown in seconds.
|
|
247
|
+
*
|
|
248
|
+
* ```js
|
|
249
|
+
* setRule.currentWaveTime(10);
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
function currentWaveTime(seconds: number): void;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Enables/disables the wave timer.
|
|
256
|
+
*
|
|
257
|
+
* ```js
|
|
258
|
+
* setRule.waveTimer(true);
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
function waveTimer(enabled: boolean): void;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Allows or prevents waves from spawning.
|
|
265
|
+
*
|
|
266
|
+
* ```js
|
|
267
|
+
* setRule.waves(true);
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
function waves(enabled: boolean): void;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Sets the current wave number.
|
|
274
|
+
*
|
|
275
|
+
* ```js
|
|
276
|
+
* setRule.wave(10);
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
function wave(number: number): void;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Sets the time between waves in seconds.
|
|
283
|
+
*
|
|
284
|
+
* ```js
|
|
285
|
+
* setRule.waveSpacing(180);
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
function waveSpacing(seconds: number): void;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Sets whether waves can be manually summoned by pressing the play button.
|
|
292
|
+
*
|
|
293
|
+
* ```js
|
|
294
|
+
* setRule.waveSending(true);
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
function waveSending(enabled: boolean): void;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Sets whether the gamemode is the attack mode
|
|
301
|
+
*
|
|
302
|
+
* ```js
|
|
303
|
+
* setRule.attackMode(true);
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
function attackMode(enabled: boolean): void;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Sets the radius of the no-build zone around enemy cores.
|
|
310
|
+
*
|
|
311
|
+
* ```js
|
|
312
|
+
* setRule.enemyCoreBuildRadius(150);
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
function enemyCoreBuildRadius(radius: number): void;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Sets the radius around enemy wave drop zones.
|
|
319
|
+
*
|
|
320
|
+
* ```js
|
|
321
|
+
* setRule.dropZoneRadius(20);
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
function dropZoneRadius(radius: number): void;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Sets the base unit cap.
|
|
328
|
+
*
|
|
329
|
+
* ```js
|
|
330
|
+
* setRule.unitCap(40);
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
function unitCap(cap: number): void;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Sets the playable map area. Blocks that are out of the new bounds will be
|
|
337
|
+
* removed.
|
|
338
|
+
*
|
|
339
|
+
* ```js
|
|
340
|
+
* setRule.mapArea({
|
|
341
|
+
* x: 0,
|
|
342
|
+
* y: 0,
|
|
343
|
+
* width: 500,
|
|
344
|
+
* height: 500,
|
|
345
|
+
* });
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
function mapArea(options: {
|
|
349
|
+
x: number;
|
|
350
|
+
y: number;
|
|
351
|
+
width: number;
|
|
352
|
+
height: number;
|
|
353
|
+
}): void;
|
|
354
|
+
|
|
355
|
+
/** Sets whether ambient lighting is enabled */
|
|
356
|
+
function lighting(enabled: boolean): void;
|
|
357
|
+
|
|
358
|
+
/** Sets whether the game can end when all cores of a team are destroyed. */
|
|
359
|
+
function canGameOver(enabled: boolean): void;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Sets the ambient light color.
|
|
363
|
+
*
|
|
364
|
+
* `packColor` can be used to get the rgba data recevied by this function.
|
|
365
|
+
*
|
|
366
|
+
* ```js
|
|
367
|
+
* // enables lighting and sets the color to gray
|
|
368
|
+
* setRule.lighting(true);
|
|
369
|
+
* setRule.ambientLight(packColor(0.5, 0.5, 0.5, 1));
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
function ambientLight(rgbaData: number): void;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Sets the multiplier for the energy output of solar panels.
|
|
376
|
+
*
|
|
377
|
+
* ```js
|
|
378
|
+
* setRule.solarMultiplier(10);
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
function solarMultiplier(multiplier: number): void;
|
|
382
|
+
|
|
383
|
+
function dragMultiplier(multiplier: number): void;
|
|
384
|
+
/**
|
|
385
|
+
* Bans a block/unit type from the world.
|
|
386
|
+
*
|
|
387
|
+
* ```js
|
|
388
|
+
* setRule.ban(Blocks.router);
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
function ban(content: BlockSymbol | UnitSymbol): void;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Removes the ban of a block/unit type in the world.
|
|
395
|
+
*
|
|
396
|
+
* ```js
|
|
397
|
+
* setRule.unban(Blocks.router);
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
function unban(content: BlockSymbol | UnitSymbol): void;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Sets the build speed multiplier of a team. The multiplier will always be
|
|
404
|
+
* clamped between `0.001` and `50`.
|
|
405
|
+
*
|
|
406
|
+
* ```js
|
|
407
|
+
* setRule.buildSpeed(Teams.sharded, 1.5);
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
function buildSpeed(team: TeamIdentifier, multiplier: number): void;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Sets the health multiplier for units on a given team. The multiplier
|
|
414
|
+
* cannot have a value lower than `0.001`.
|
|
415
|
+
*
|
|
416
|
+
* ```js
|
|
417
|
+
* setRule.unitHealth(Teams.sharded, 1.5);
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
function unitHealth(team: TeamIdentifier, multiplier: number): void;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Sets the speed multiplier for unit factories. The multiplier will always
|
|
424
|
+
* be clamped between `0` and `50`.
|
|
425
|
+
*
|
|
426
|
+
* ```js
|
|
427
|
+
* setRule.unitBuildSpeed(Teams.sharded, 3);
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
function unitBuildSpeed(team: TeamIdentifier, multiplier: number): void;
|
|
431
|
+
|
|
432
|
+
function unitMineSpeed(team: TeamIdentifier, multiplier: number): void;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Sets the build cost multiplier for constructing units.
|
|
436
|
+
*
|
|
437
|
+
* ```js
|
|
438
|
+
* setRule.unitCost(Teams.sharded, 1.75);
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
function unitCost(team: TeamIdentifier, multiplier: number): void;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Sets the damage multiplier for units on a given team.
|
|
445
|
+
*
|
|
446
|
+
* ```js
|
|
447
|
+
* setRule.unitDamage(Teams.sharded, 1.25);
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
function unitDamage(team: TeamIdentifier, multiplier: number): void;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Sets the block health multiplier for a given team.
|
|
454
|
+
*
|
|
455
|
+
* ```js
|
|
456
|
+
* setRule.blockHealth(Teams.crux, 0.75);
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
function blockHealth(team: TeamIdentifier, multiplier: number): void;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Sets the block damage multiplier for a given team.
|
|
463
|
+
*
|
|
464
|
+
* ```js
|
|
465
|
+
* setRule.blockDamage(Teams.crux, 2);
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
function blockDamage(team: TeamIdentifier, multiplier: number): void;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Sets the Real Time Strategy minimum weight for a team.
|
|
472
|
+
*
|
|
473
|
+
* In other words it, sets the minimum "advantage" needed for a squad to
|
|
474
|
+
* attack. The higher the value, the more cautious the squad is.
|
|
475
|
+
*
|
|
476
|
+
* ```js
|
|
477
|
+
* setRule.rtsMinWeight(Teams.sharded, 3);
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
|
|
481
|
+
function rtsMinWeight(team: TeamIdentifier, value: number): void;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Sets the Real Time Strategy minimum size of attack squads of a team.
|
|
485
|
+
*
|
|
486
|
+
* The higher the value, the more units are required before a squad attacks.
|
|
487
|
+
*
|
|
488
|
+
* ```js
|
|
489
|
+
* setRule.rtsMinSquad(Teams.sharded, 5);
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
function rtsMinSquad(team: TeamIdentifier, value: number): void;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Sets whether units have ambient light.
|
|
496
|
+
*
|
|
497
|
+
* ```js
|
|
498
|
+
* setRule.unitLight(true);
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
function unitLight(enabled: boolean): void;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Sets whether pausing the game is disabled.
|
|
505
|
+
*
|
|
506
|
+
* ```js
|
|
507
|
+
* setRule.pauseDisabled(true);
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
function pauseDisabled(enabled: boolean): void;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Sets the background music volume.
|
|
514
|
+
*
|
|
515
|
+
* ```js
|
|
516
|
+
* setRule.musicVolume(0.5);
|
|
517
|
+
* ```
|
|
518
|
+
*/
|
|
519
|
+
function musicVolume(volume: number): void;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Writes the contents of the global text buffer in the selected mode and
|
|
524
|
+
* clears the buffer afterwards.
|
|
525
|
+
*
|
|
526
|
+
* ```js
|
|
527
|
+
* print("Hello");
|
|
528
|
+
* flushMessage.announce(4); // lasts 4 seconds
|
|
529
|
+
* wait(5);
|
|
530
|
+
* print("World");
|
|
531
|
+
* flushMessage.toast(4);
|
|
532
|
+
* wait(5);
|
|
533
|
+
* ```
|
|
534
|
+
*/
|
|
535
|
+
export namespace flushMessage {
|
|
536
|
+
/**
|
|
537
|
+
* Shows a nofication at the top of the screen.
|
|
538
|
+
*
|
|
539
|
+
* Returns whether the operation was executed successfully.
|
|
540
|
+
*
|
|
541
|
+
* ```js
|
|
542
|
+
* print("something");
|
|
543
|
+
* flushMessage.notify();
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
function notify(): boolean;
|
|
547
|
+
/**
|
|
548
|
+
* Puts the content on the top left corner of the screen
|
|
549
|
+
*
|
|
550
|
+
* Returns whether the operation was executed successfully.
|
|
551
|
+
*
|
|
552
|
+
* ```js
|
|
553
|
+
* print("something");
|
|
554
|
+
* flushMessage.mission();
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
function mission(): boolean;
|
|
558
|
+
/**
|
|
559
|
+
* Puts the content on the middle of the screen
|
|
560
|
+
*
|
|
561
|
+
* Returns whether the operation was executed successfully.
|
|
562
|
+
*
|
|
563
|
+
* @param duration The duration, in seconds
|
|
564
|
+
*
|
|
565
|
+
* ```js
|
|
566
|
+
* print("something");
|
|
567
|
+
* flushMessage.announce(3);
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
function announce(duration: number): boolean;
|
|
571
|
+
/**
|
|
572
|
+
* Puts the content on the middle top of the screen
|
|
573
|
+
*
|
|
574
|
+
* Returns whether the operation was executed successfully.
|
|
575
|
+
*
|
|
576
|
+
* @param duration The duration, in seconds
|
|
577
|
+
*
|
|
578
|
+
* ```js
|
|
579
|
+
* print("something");
|
|
580
|
+
* flushMessage.toast(5);
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
function toast(duration: number): boolean;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Shows a nofication at the top of the screen.
|
|
587
|
+
*
|
|
588
|
+
* Blocks execution until the message is displayed.
|
|
589
|
+
*
|
|
590
|
+
* ```js
|
|
591
|
+
* print("something");
|
|
592
|
+
* flushMessage.notify();
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
function notifySync(): void;
|
|
596
|
+
/**
|
|
597
|
+
* Puts the content on the top left corner of the screen
|
|
598
|
+
*
|
|
599
|
+
* Blocks execution until the message is displayed.
|
|
600
|
+
*
|
|
601
|
+
* ```js
|
|
602
|
+
* print("something");
|
|
603
|
+
* flushMessage.mission();
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
function missionSync(): void;
|
|
607
|
+
/**
|
|
608
|
+
* Puts the content on the middle of the screen
|
|
609
|
+
*
|
|
610
|
+
* Blocks execution until the message is displayed.
|
|
611
|
+
*
|
|
612
|
+
* @param duration The duration, in seconds
|
|
613
|
+
*
|
|
614
|
+
* ```js
|
|
615
|
+
* print("something");
|
|
616
|
+
* flushMessage.announce(3);
|
|
617
|
+
* ```
|
|
618
|
+
*/
|
|
619
|
+
function announceSync(duration: number): void;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Puts the content on the middle top of the screen
|
|
623
|
+
*
|
|
624
|
+
* Blocks execution until the message is displayed.
|
|
625
|
+
*
|
|
626
|
+
* @param duration The duration, in seconds
|
|
627
|
+
*
|
|
628
|
+
* ```js
|
|
629
|
+
* print("something");
|
|
630
|
+
* flushMessage.toast(5);
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
function toastSync(duration: number): void;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/** Controls the player camera. */
|
|
637
|
+
export namespace cutscene {
|
|
638
|
+
/**
|
|
639
|
+
* Moves the player's camera to the given location.
|
|
640
|
+
*
|
|
641
|
+
* ```js
|
|
642
|
+
* cutscene.pan({
|
|
643
|
+
* x: 10,
|
|
644
|
+
* y: 20,
|
|
645
|
+
* speed: 15,
|
|
646
|
+
* });
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
function pan(options: { x: number; y: number; speed: number }): void;
|
|
650
|
+
/**
|
|
651
|
+
* Zooms the player camera to the desired level
|
|
652
|
+
*
|
|
653
|
+
* ```js
|
|
654
|
+
* cutscene.zoom(3);
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
function zoom(level: number): void;
|
|
658
|
+
/**
|
|
659
|
+
* Gives the camera control back to the player
|
|
660
|
+
*
|
|
661
|
+
* ```js
|
|
662
|
+
* cutscene.stop();
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
function stop(): void;
|
|
666
|
+
/**
|
|
667
|
+
* Checks if a cutscene is currently active.
|
|
668
|
+
*
|
|
669
|
+
* ```js
|
|
670
|
+
* const isActive = cutscene.active();
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
function active(): boolean;
|
|
674
|
+
/**
|
|
675
|
+
* Shakes the player screen.
|
|
676
|
+
*
|
|
677
|
+
* ```js
|
|
678
|
+
* cutscene.shake(10, 2);
|
|
679
|
+
* ```
|
|
680
|
+
*/
|
|
681
|
+
function shake(amount: number, duration: number): void;
|
|
682
|
+
/**
|
|
683
|
+
* Checks if the HUD is currently visible.
|
|
684
|
+
*
|
|
685
|
+
* ```js
|
|
686
|
+
* const hudShown = cutscene.getHud();
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
function getHud(): boolean;
|
|
690
|
+
/**
|
|
691
|
+
* Shows or hides the player HUD.
|
|
692
|
+
*
|
|
693
|
+
* ```js
|
|
694
|
+
* cutscene.setHud(false);
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
function setHud(shown: boolean): void;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Creates an explosion.
|
|
702
|
+
*
|
|
703
|
+
* ```js
|
|
704
|
+
* explosion({
|
|
705
|
+
* team: Teams.crux,
|
|
706
|
+
* x: 5,
|
|
707
|
+
* y: 15,
|
|
708
|
+
* radius: 20,
|
|
709
|
+
* damage: 100,
|
|
710
|
+
* air: true,
|
|
711
|
+
* ground: true,
|
|
712
|
+
* pierce: true,
|
|
713
|
+
* effect: true,
|
|
714
|
+
* });
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
export function explosion(options: {
|
|
718
|
+
team: TeamIdentifier;
|
|
719
|
+
x: number;
|
|
720
|
+
y: number;
|
|
721
|
+
radius: number;
|
|
722
|
+
damage: number;
|
|
723
|
+
air: boolean;
|
|
724
|
+
ground: boolean;
|
|
725
|
+
pierce: boolean;
|
|
726
|
+
effect: boolean;
|
|
727
|
+
}): void;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Sets the speed of this world processor in instructions per tick.
|
|
731
|
+
*
|
|
732
|
+
* ```js
|
|
733
|
+
* setRate(20);
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
export function setRate(ipt: number): void;
|
|
737
|
+
|
|
738
|
+
/** Contains the variants of the `fetch` instruction. */
|
|
739
|
+
export namespace fetch {
|
|
740
|
+
/**
|
|
741
|
+
* Gets an unit from the given team
|
|
742
|
+
*
|
|
743
|
+
* The index starts at 0.
|
|
744
|
+
*
|
|
745
|
+
* ```js
|
|
746
|
+
* const count = fetch.unitCount(Teams.sharded);
|
|
747
|
+
* for (let i = 0; i < count; i++) {
|
|
748
|
+
* const unit = fetch.unit(Teams.sharded, i);
|
|
749
|
+
* print`x: ${unit.x}, y: ${unit.y}\n`;
|
|
750
|
+
* }
|
|
751
|
+
* printFlush();
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
function unit<T extends BasicUnit = AnyUnit>(
|
|
755
|
+
team: TeamIdentifier,
|
|
756
|
+
index: number,
|
|
757
|
+
type?: UnitSymbol,
|
|
758
|
+
): T;
|
|
759
|
+
/**
|
|
760
|
+
* Gets the amount of units existing on a given team.
|
|
761
|
+
*
|
|
762
|
+
* If `type` is not specified, returns the total amount of units
|
|
763
|
+
*
|
|
764
|
+
* ```js
|
|
765
|
+
* const count = fetch.unitCount(Teams.sharded);
|
|
766
|
+
* for (let i = 0; i < count; i++) {
|
|
767
|
+
* const unit = fetch.unit(Teams.sharded, i);
|
|
768
|
+
* print`x: ${unit.x}, y: ${unit.y}\n`;
|
|
769
|
+
* }
|
|
770
|
+
* printFlush();
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
function unitCount(team: TeamIdentifier, type?: UnitSymbol): number;
|
|
774
|
+
/**
|
|
775
|
+
* Gets a player from a team.
|
|
776
|
+
*
|
|
777
|
+
* The index starts at 0.
|
|
778
|
+
*
|
|
779
|
+
* ```js
|
|
780
|
+
* const count = fetch.playerCount(Teams.sharded);
|
|
781
|
+
* for (let i = 0; i < count; i++) {
|
|
782
|
+
* const player = fetch.player(Teams.sharded, i);
|
|
783
|
+
* print`x: ${player.x}, y: ${player.y}\n`;
|
|
784
|
+
* }
|
|
785
|
+
* printFlush();
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
function player<T extends BasicUnit = AnyUnit>(
|
|
789
|
+
team: TeamIdentifier,
|
|
790
|
+
index: number,
|
|
791
|
+
): T;
|
|
792
|
+
/**
|
|
793
|
+
* Gets the amount of players existing on a given team.
|
|
794
|
+
*
|
|
795
|
+
* ```js
|
|
796
|
+
* const count = fetch.playerCount(Teams.sharded);
|
|
797
|
+
* for (let i = 0; i < count; i++) {
|
|
798
|
+
* const player = fetch.player(Teams.sharded, i);
|
|
799
|
+
* print`x: ${player.x}, y: ${player.y}\n`;
|
|
800
|
+
* }
|
|
801
|
+
* printFlush();
|
|
802
|
+
* ```
|
|
803
|
+
*/
|
|
804
|
+
function playerCount(team: TeamIdentifier): number;
|
|
805
|
+
/**
|
|
806
|
+
* Gets a core from a team.
|
|
807
|
+
*
|
|
808
|
+
* The index of the starts at 0.
|
|
809
|
+
*
|
|
810
|
+
* ```js
|
|
811
|
+
* const count = fetch.coreCount(Teams.sharded);
|
|
812
|
+
* for (let i = 0; i < count; i++) {
|
|
813
|
+
* const core = fetch.core(Teams.sharded, i);
|
|
814
|
+
* print`x: ${core.x}, y: ${core.y}\n`;
|
|
815
|
+
* }
|
|
816
|
+
* printFlush();
|
|
817
|
+
* ```
|
|
818
|
+
*/
|
|
819
|
+
function core(team: TeamIdentifier, index: number): AnyBuilding;
|
|
820
|
+
/**
|
|
821
|
+
* Gets the amount of cores existing on a given team.
|
|
822
|
+
*
|
|
823
|
+
* ```js
|
|
824
|
+
* const count = fetch.coreCount(Teams.sharded);
|
|
825
|
+
* for (let i = 0; i < count; i++) {
|
|
826
|
+
* const core = fetch.core(Teams.sharded, i);
|
|
827
|
+
* print`x: ${core.x}, y: ${core.y}\n`;
|
|
828
|
+
* }
|
|
829
|
+
* printFlush();
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
832
|
+
function coreCount(team: TeamIdentifier): number;
|
|
833
|
+
/**
|
|
834
|
+
* Gets a building from a team.
|
|
835
|
+
*
|
|
836
|
+
* The index starts at 0.
|
|
837
|
+
*
|
|
838
|
+
* ```js
|
|
839
|
+
* const count = fetch.buildCount(Teams.sharded, Blocks.router);
|
|
840
|
+
* for (let i = 0; i < count; i++) {
|
|
841
|
+
* const router = fetch.build(Teams.sharded, i, Blocks.router);
|
|
842
|
+
* print`x: ${router.x}, y: ${router.y}\n`;
|
|
843
|
+
* }
|
|
844
|
+
* printFlush();
|
|
845
|
+
* ```
|
|
846
|
+
*/
|
|
847
|
+
function build<T extends BasicBuilding = AnyBuilding>(
|
|
848
|
+
team: TeamIdentifier,
|
|
849
|
+
index: number,
|
|
850
|
+
block: BuildingSymbol,
|
|
851
|
+
): T;
|
|
852
|
+
/**
|
|
853
|
+
* Gets the amount of buildings existing on a given team.
|
|
854
|
+
*
|
|
855
|
+
* If `type` is not specified, returns the total amount of buildings
|
|
856
|
+
*
|
|
857
|
+
* ```js
|
|
858
|
+
* const count = fetch.buildCount(Teams.sharded, Blocks.router);
|
|
859
|
+
* for (let i = 0; i < count; i++) {
|
|
860
|
+
* const router = fetch.build(Teams.sharded, i, Blocks.router);
|
|
861
|
+
* print`x: ${router.x}, y: ${router.y}\n`;
|
|
862
|
+
* }
|
|
863
|
+
* printFlush();
|
|
864
|
+
* ```
|
|
865
|
+
*/
|
|
866
|
+
function buildCount(team: TeamIdentifier, type?: BuildingSymbol): number;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Checks if a global flag is set.
|
|
871
|
+
*
|
|
872
|
+
* ```js
|
|
873
|
+
* const flagEnabled = getFlag("foo");
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
export function getFlag(flag: string): boolean;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Sets a global flag.
|
|
880
|
+
*
|
|
881
|
+
* ```js
|
|
882
|
+
* setFlag("foo", true);
|
|
883
|
+
* ```
|
|
884
|
+
*/
|
|
885
|
+
export function setFlag(flag: string, value: boolean): void;
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Creates a writable record that allows you to set a property of a building
|
|
889
|
+
* or unit.
|
|
890
|
+
*
|
|
891
|
+
* ```js
|
|
892
|
+
* const router = fetch.build(Teams.sharded, 0, Blocks.router);
|
|
893
|
+
* setProp(router).team = Teams.derelict;
|
|
894
|
+
* ```
|
|
895
|
+
*/
|
|
896
|
+
export function setProp(target: BasicBuilding): SettableBuilding;
|
|
897
|
+
export function setProp(target: BasicUnit): SettableUnit;
|
|
898
|
+
export function setProp(target: Bullet): SettableBullet;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Allows code running on the server to asynchronously send its version of a
|
|
902
|
+
* single register to the client.
|
|
903
|
+
*
|
|
904
|
+
* Can be used up to 20 times per second.
|
|
905
|
+
*/
|
|
906
|
+
export class SyncLock<T extends number | string | symbol | undefined> {
|
|
907
|
+
/**
|
|
908
|
+
* The value held by this sync lock, synchronized whenever `sendToClients`
|
|
909
|
+
* is called.
|
|
910
|
+
*/
|
|
911
|
+
value: T;
|
|
912
|
+
|
|
913
|
+
constructor(value?: T);
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* When running on the server, sends the value of this sync lock to every
|
|
917
|
+
* client in the game.
|
|
918
|
+
*/
|
|
919
|
+
sendToClients(): void;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export namespace effect {
|
|
923
|
+
function warn(x: number, y: number): void;
|
|
924
|
+
function cross(x: number, y: number): void;
|
|
925
|
+
function blockFall(x: number, y: number, data: BlockSymbol): void;
|
|
926
|
+
function placeBlock(x: number, y: number, size: number): void;
|
|
927
|
+
function placeBlockSpark(x: number, y: number, size: number): void;
|
|
928
|
+
function breakBlock(x: number, y: number, size: number): void;
|
|
929
|
+
function spawn(x: number, y: number): void;
|
|
930
|
+
function trail(options: {
|
|
931
|
+
x: number;
|
|
932
|
+
y: number;
|
|
933
|
+
color: number;
|
|
934
|
+
size: number;
|
|
935
|
+
}): void;
|
|
936
|
+
function breakPop(options: {
|
|
937
|
+
x: number;
|
|
938
|
+
y: number;
|
|
939
|
+
color: number;
|
|
940
|
+
size: number;
|
|
941
|
+
}): void;
|
|
942
|
+
function breakProp(options: {
|
|
943
|
+
x: number;
|
|
944
|
+
y: number;
|
|
945
|
+
color: number;
|
|
946
|
+
size: number;
|
|
947
|
+
}): void;
|
|
948
|
+
function smokeCloud(x: number, y: number, color: number): void;
|
|
949
|
+
function vapor(x: number, y: number, color: number): void;
|
|
950
|
+
function hit(x: number, y: number, color: number): void;
|
|
951
|
+
function hitSquare(x: number, y: number, color: number): void;
|
|
952
|
+
function shootSmall(options: {
|
|
953
|
+
x: number;
|
|
954
|
+
y: number;
|
|
955
|
+
color: number;
|
|
956
|
+
rotation: number;
|
|
957
|
+
}): void;
|
|
958
|
+
function shootBig(options: {
|
|
959
|
+
x: number;
|
|
960
|
+
y: number;
|
|
961
|
+
color: number;
|
|
962
|
+
rotation: number;
|
|
963
|
+
}): void;
|
|
964
|
+
function smokeSmall(x: number, y: number, rotation: number): void;
|
|
965
|
+
function smokeBig(x: number, y: number, rotation: number): void;
|
|
966
|
+
function smokeColor(options: {
|
|
967
|
+
x: number;
|
|
968
|
+
y: number;
|
|
969
|
+
color: number;
|
|
970
|
+
rotation: number;
|
|
971
|
+
}): void;
|
|
972
|
+
function smokeSquare(options: {
|
|
973
|
+
x: number;
|
|
974
|
+
y: number;
|
|
975
|
+
color: number;
|
|
976
|
+
rotation: number;
|
|
977
|
+
}): void;
|
|
978
|
+
function smokeSquareBig(options: {
|
|
979
|
+
x: number;
|
|
980
|
+
y: number;
|
|
981
|
+
color: number;
|
|
982
|
+
rotation: number;
|
|
983
|
+
}): void;
|
|
984
|
+
function spark(x: number, y: number, color: number): void;
|
|
985
|
+
function sparkBig(x: number, y: number, color: number): void;
|
|
986
|
+
function sparkShoot(options: {
|
|
987
|
+
x: number;
|
|
988
|
+
y: number;
|
|
989
|
+
color: number;
|
|
990
|
+
rotation: number;
|
|
991
|
+
}): void;
|
|
992
|
+
function sparkShootBig(options: {
|
|
993
|
+
x: number;
|
|
994
|
+
y: number;
|
|
995
|
+
color: number;
|
|
996
|
+
rotation: number;
|
|
997
|
+
}): void;
|
|
998
|
+
function drill(x: number, y: number, color: number): void;
|
|
999
|
+
function drillBig(x: number, y: number, color: number): void;
|
|
1000
|
+
function lightBlock(options: {
|
|
1001
|
+
x: number;
|
|
1002
|
+
y: number;
|
|
1003
|
+
color: number;
|
|
1004
|
+
size: number;
|
|
1005
|
+
}): void;
|
|
1006
|
+
function explosion(x: number, y: number, size: number): void;
|
|
1007
|
+
function smokePuff(x: number, y: number, color: number): void;
|
|
1008
|
+
function sparkExplosion(x: number, y: number, color: number): void;
|
|
1009
|
+
function crossExplosion(options: {
|
|
1010
|
+
x: number;
|
|
1011
|
+
y: number;
|
|
1012
|
+
color: number;
|
|
1013
|
+
size: number;
|
|
1014
|
+
}): void;
|
|
1015
|
+
function wave(options: {
|
|
1016
|
+
x: number;
|
|
1017
|
+
y: number;
|
|
1018
|
+
color: number;
|
|
1019
|
+
size: number;
|
|
1020
|
+
}): void;
|
|
1021
|
+
function bubble(x: number, y: number): void;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
export namespace playSound {
|
|
1025
|
+
function positional(options: {
|
|
1026
|
+
sound: number;
|
|
1027
|
+
volume: number;
|
|
1028
|
+
pitch: number;
|
|
1029
|
+
x: number;
|
|
1030
|
+
y: number;
|
|
1031
|
+
limit: boolean;
|
|
1032
|
+
}): void;
|
|
1033
|
+
|
|
1034
|
+
function global(options: {
|
|
1035
|
+
sound: number;
|
|
1036
|
+
volume: number;
|
|
1037
|
+
pitch: number;
|
|
1038
|
+
pan: number;
|
|
1039
|
+
limit: boolean;
|
|
1040
|
+
}): void;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/** Represents a maker, invoking the methods or */
|
|
1044
|
+
export interface Marker {
|
|
1045
|
+
/** Deletes the marker, making its id available for reuse. */
|
|
1046
|
+
remove(): void;
|
|
1047
|
+
set world(value: boolean);
|
|
1048
|
+
/** Wether the marker should be on the minimap or in the world */
|
|
1049
|
+
set minimap(value: boolean);
|
|
1050
|
+
set light(value: boolean);
|
|
1051
|
+
set autoscale(value: boolean);
|
|
1052
|
+
set pos(value: { x: number; y: number });
|
|
1053
|
+
set endPos(value: { x: number; y: number });
|
|
1054
|
+
set drawLayer(value: number);
|
|
1055
|
+
set color(value: number);
|
|
1056
|
+
set radius(value: number);
|
|
1057
|
+
set stroke(value: number);
|
|
1058
|
+
set rotation(value: number);
|
|
1059
|
+
set shape(value: { sides: number; fill: boolean; outline: boolean });
|
|
1060
|
+
set arc(value: { start: number; end: number });
|
|
1061
|
+
/**
|
|
1062
|
+
* Writes the contents of the global text buffer to the marker's text.
|
|
1063
|
+
* Empties the global text buffer.
|
|
1064
|
+
*/
|
|
1065
|
+
flushText(options: { fetch: boolean }): void;
|
|
1066
|
+
set fontSize(value: number);
|
|
1067
|
+
set textAlign(value: Align);
|
|
1068
|
+
set lineAlign(value: Align);
|
|
1069
|
+
set textHeight(value: number);
|
|
1070
|
+
set outline(value: boolean);
|
|
1071
|
+
set labelFlags(value: { background: boolean; outline: boolean });
|
|
1072
|
+
set texture(value: string);
|
|
1073
|
+
/** Writes the contents of the global text buffer to the marker's texture. */
|
|
1074
|
+
flushTexture(): void;
|
|
1075
|
+
set textureSize(value: { width: number; height: number });
|
|
1076
|
+
/**
|
|
1077
|
+
* Indexed position, used for line and quad markers with index zero being
|
|
1078
|
+
* the first position.
|
|
1079
|
+
*/
|
|
1080
|
+
set posi(value: { index: number; x: number; y: number });
|
|
1081
|
+
/** Texture's position ranging from zero to one, used for quad markers. */
|
|
1082
|
+
set uvi(value: { index: number; x: number; y: number });
|
|
1083
|
+
/**
|
|
1084
|
+
* Indexed position, used for line and quad markers with index zero being
|
|
1085
|
+
* the first color.
|
|
1086
|
+
*/
|
|
1087
|
+
set colori(value: { index: number; color: number });
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
interface MarkerConstructor {
|
|
1091
|
+
/**
|
|
1092
|
+
* Creates a marker object with the given id.
|
|
1093
|
+
*
|
|
1094
|
+
* This function provides access to existing markers and does not generate a
|
|
1095
|
+
* `makemaker` instruction.
|
|
1096
|
+
*/
|
|
1097
|
+
of(id: number): Marker;
|
|
1098
|
+
|
|
1099
|
+
/** Creates a new logic marker in the world. */
|
|
1100
|
+
shapeText(options: {
|
|
1101
|
+
id: number;
|
|
1102
|
+
x: number;
|
|
1103
|
+
y: number;
|
|
1104
|
+
replace: boolean;
|
|
1105
|
+
}): Marker;
|
|
1106
|
+
minimap(options: {
|
|
1107
|
+
id: number;
|
|
1108
|
+
x: number;
|
|
1109
|
+
y: number;
|
|
1110
|
+
replace: boolean;
|
|
1111
|
+
}): Marker;
|
|
1112
|
+
shape(options: {
|
|
1113
|
+
id: number;
|
|
1114
|
+
x: number;
|
|
1115
|
+
y: number;
|
|
1116
|
+
replace: boolean;
|
|
1117
|
+
}): Marker;
|
|
1118
|
+
line(options: {
|
|
1119
|
+
id: number;
|
|
1120
|
+
x: number;
|
|
1121
|
+
y: number;
|
|
1122
|
+
replace: boolean;
|
|
1123
|
+
}): Marker;
|
|
1124
|
+
text(options: {
|
|
1125
|
+
id: number;
|
|
1126
|
+
x: number;
|
|
1127
|
+
y: number;
|
|
1128
|
+
replace: boolean;
|
|
1129
|
+
}): Marker;
|
|
1130
|
+
texture(options: {
|
|
1131
|
+
id: number;
|
|
1132
|
+
x: number;
|
|
1133
|
+
y: number;
|
|
1134
|
+
replace: boolean;
|
|
1135
|
+
}): Marker;
|
|
1136
|
+
quad(options: {
|
|
1137
|
+
id: number;
|
|
1138
|
+
x: number;
|
|
1139
|
+
y: number;
|
|
1140
|
+
replace: boolean;
|
|
1141
|
+
}): Marker;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/** Contains methods to create marker objects. */
|
|
1145
|
+
export var Marker: MarkerConstructor;
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Add map locale property value to the global text buffer.
|
|
1149
|
+
*
|
|
1150
|
+
* To set map locale bundles in map editor, check Map Info > Locale Bundles.
|
|
1151
|
+
*
|
|
1152
|
+
* If client is a mobile device, tries to print a property ending in ".mobile"
|
|
1153
|
+
* first.
|
|
1154
|
+
*
|
|
1155
|
+
* ```js
|
|
1156
|
+
* localePrint("map.locale.key");
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1159
|
+
export function localePrint(key: string): void;
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* Plays a background music track.
|
|
1163
|
+
*
|
|
1164
|
+
* @param name The name of the music track (e.g. "game1").
|
|
1165
|
+
* @param interrupt Whether to interrupt currently playing track. Defaults to
|
|
1166
|
+
* `true`.
|
|
1167
|
+
*/
|
|
1168
|
+
export function playMusic(name: string, interrupt?: boolean): void;
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Queries entities within a shape into the privileged `@queries` variable.
|
|
1172
|
+
* Access results using `PVars.queries`.
|
|
1173
|
+
*/
|
|
1174
|
+
export namespace query {
|
|
1175
|
+
/** Queries units or buildings within a circular area into `PVars.queries`. */
|
|
1176
|
+
function circle(options: {
|
|
1177
|
+
type: "unit" | "building";
|
|
1178
|
+
team?: TeamIdentifier;
|
|
1179
|
+
x: number;
|
|
1180
|
+
y: number;
|
|
1181
|
+
radius: number;
|
|
1182
|
+
}): void;
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Queries units or buildings within a rectangular area into
|
|
1186
|
+
* `PVars.queries`.
|
|
1187
|
+
*/
|
|
1188
|
+
function rect(options: {
|
|
1189
|
+
type: "unit" | "building";
|
|
1190
|
+
team?: TeamIdentifier;
|
|
1191
|
+
x: number;
|
|
1192
|
+
y: number;
|
|
1193
|
+
width: number;
|
|
1194
|
+
height: number;
|
|
1195
|
+
}): void;
|
|
1196
|
+
}
|
|
1197
|
+
}
|