@chronodivide/game-api 0.35.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.
@@ -0,0 +1,1734 @@
1
+ export declare class ActionsApi {
2
+ #private;
3
+ placeBuilding(buildingName: string, rx: number, ry: number): void;
4
+ sellBuilding(buildingId: number): void;
5
+ toggleRepairWrench(buildingId: number): void;
6
+ toggleAlliance(toPlayer: string, enabled: boolean): void;
7
+ pauseProduction(queueType: QueueType): void;
8
+ resumeProduction(queueType: QueueType): void;
9
+ queueForProduction(queueType: QueueType, objName: string, objType: ObjectType, quantity: number): void;
10
+ unqueueFromProduction(queueType: QueueType, objName: string, objType: ObjectType, quantity: number): void;
11
+ activateSuperWeapon(type: SuperWeaponType, tile: {
12
+ rx: number;
13
+ ry: number;
14
+ }, tile2?: {
15
+ rx: number;
16
+ ry: number;
17
+ }): void;
18
+ orderUnits(unitIds: number[], orderType: OrderType): void;
19
+ orderUnits(unitIds: number[], orderType: OrderType, targetUnit: number): void;
20
+ orderUnits(unitIds: number[], orderType: OrderType, rx: number, ry: number, onBridge?: boolean): void;
21
+ quitGame(): void;
22
+ }
23
+
24
+ export declare interface Agent {
25
+ name: string;
26
+ /** Country name as found in rules.ini [Countries] */
27
+ country: string;
28
+ }
29
+
30
+ export declare class AiRules {
31
+ buildPower: string[];
32
+ buildRefinery: string[];
33
+ buildTech: string[];
34
+ tiberiumFarScan: number;
35
+ tiberiumNearScan: number;
36
+ readIni(ini: IniSection): void;
37
+ }
38
+
39
+ export declare type ApiEvent = ObjectOwnerChangeApiEvent | ObjectSpawnUnspawnApiEvent | ObjectDestroyApiEvent;
40
+
41
+ export declare enum ApiEventType {
42
+ ObjectOwnerChange = 0,
43
+ ObjectSpawn = 1,
44
+ ObjectUnspawn = 2,
45
+ ObjectDestroy = 3
46
+ }
47
+
48
+ export declare enum ArmorType {
49
+ None = 0,
50
+ Flak = 1,
51
+ Plate = 2,
52
+ Light = 3,
53
+ Medium = 4,
54
+ Heavy = 5,
55
+ Wood = 6,
56
+ Steel = 7,
57
+ Concrete = 8,
58
+ Special_1 = 9,
59
+ Special_2 = 10
60
+ }
61
+
62
+ export declare enum AttackState {
63
+ Idle = 0,
64
+ /** Check range + LoS and move to a valid position if needed */
65
+ CheckRange = 1,
66
+ /** Perform LoS checks, wait for weapon cooldown etc. */
67
+ PrepareToFire = 2,
68
+ /** This means the fire animation was started, but the weapon wasn't fired yet */
69
+ FireUp = 3,
70
+ Firing = 4,
71
+ JustFired = 5
72
+ }
73
+
74
+ export declare class Bot {
75
+ name: string;
76
+ country: string;
77
+ protected gameApi: GameApi;
78
+ protected actionsApi: ActionsApi;
79
+ protected productionApi: ProductionApi;
80
+ constructor(name: string, country: string);
81
+ onGameStart(gameApi: GameApi): void;
82
+ onGameTick(gameApi: GameApi): void;
83
+ onGameEvent(ev: ApiEvent, gameApi: GameApi): void;
84
+ }
85
+
86
+ export declare enum BuildCat {
87
+ Combat = 0,
88
+ Tech = 1,
89
+ Resource = 2,
90
+ Power = 3
91
+ }
92
+
93
+ export declare interface BuildingPlacementData {
94
+ /** The size of the building foundation in tiles */
95
+ foundation: Size;
96
+ /** The offset of the foundation center tile */
97
+ foundationCenter: Point2D;
98
+ }
99
+
100
+ export declare enum BuildStatus {
101
+ BuildUp = 0,
102
+ Ready = 1,
103
+ /** When the building is being deconstructed (e.g. sold or undeployed) */
104
+ BuildDown = 2
105
+ }
106
+
107
+ export declare const cdapi: PublicApi;
108
+
109
+ export declare class CombatDamageRules {
110
+ ballisticScatter: number;
111
+ bridgeStrength: number;
112
+ c4Delay: number;
113
+ c4Warhead: string;
114
+ deathWeapon: string;
115
+ dMislEliteWarhead: string;
116
+ dMislWarhead: string;
117
+ ironCurtainDuration: number;
118
+ ivanDamage: number;
119
+ ivanIconFlickerRate: number;
120
+ ivanTimedDelay: number;
121
+ ivanWarhead: string;
122
+ splashList: string[];
123
+ v3EliteWarhead: string;
124
+ v3Warhead: string;
125
+ readIni(ini: IniSection): void;
126
+ }
127
+
128
+ /** Player faction */
129
+ export declare class Country {
130
+ private rules;
131
+ get side(): SideType;
132
+ get name(): string;
133
+ isPlayable(): boolean;
134
+ hasVeteranUnit(objectType: ObjectType, name: string): boolean;
135
+ }
136
+
137
+ /** Data structure for rules.ini country sections */
138
+ export declare class CountryRules {
139
+ side: SideType;
140
+ /** string identifier */
141
+ name: string;
142
+ /** translation key */
143
+ uiName: string;
144
+ /** translation key */
145
+ uiTooltip: string | undefined;
146
+ /** allowed in multiplayer */
147
+ multiplay: boolean;
148
+ multiplayPassive: boolean;
149
+ veteranAircraft: string[];
150
+ veteranInfantry: string[];
151
+ veteranUnits: string[];
152
+ readIni(ini: IniSection): void;
153
+ }
154
+
155
+ export declare class CrateRules {
156
+ /** Crates can never exceed this quantity */
157
+ crateMaximum: number;
158
+ /**
159
+ * Minimum number of crates to be on the map at any given time.
160
+ * This is normally one crate per human player although it will never be below this number.
161
+ */
162
+ crateMinimum: number;
163
+ /** The radius, in cells, that crate powerup bonuses (e.g. armor or speed) will affect. */
164
+ crateRadius: number;
165
+ /** Average minutes between random powerup crate regeneration */
166
+ crateRegen: number;
167
+ /**
168
+ * Specify the unit which a player gets from a crate.
169
+ * If this is not set then the game will pick a unit randomly from those that do not have CrateGoodie=no set
170
+ */
171
+ unitCrateType: string | undefined;
172
+ healCrateSound: string;
173
+ /** The OverlayType to use as an image for the standard crate */
174
+ crateImg: string;
175
+ waterCrateImg: string;
176
+ /** Give free MCV from crate if no buildings but still has money */
177
+ freeMCV: boolean;
178
+ readIni(ini: IniSection): this;
179
+ }
180
+
181
+ export declare interface CreateBaseOpts {
182
+ mapName: string;
183
+ gameMode: number;
184
+ shortGame: boolean;
185
+ mcvRepacks: boolean;
186
+ cratesAppear: boolean;
187
+ superWeapons: boolean;
188
+ gameSpeed: number;
189
+ credits: number;
190
+ unitCount: number;
191
+ buildOffAlly: boolean;
192
+ }
193
+
194
+ export declare interface CreateOfflineOpts extends CreateBaseOpts {
195
+ online?: false;
196
+ agents: Bot[];
197
+ }
198
+
199
+ export declare interface CreateOnlineOpts extends CreateBaseOpts {
200
+ online: true;
201
+ serverUrl: string;
202
+ clientUrl: string;
203
+ agents: [Bot, ...Agent[]];
204
+ }
205
+
206
+ export declare type CreateOpts = CreateOfflineOpts | CreateOnlineOpts;
207
+
208
+ export declare class CrewRules {
209
+ alliedCrew: string;
210
+ alliedSurvivorDivisor: number;
211
+ crewEscape: number;
212
+ sovietCrew: string;
213
+ sovietSurvivorDivisor: number;
214
+ survivorRate: number;
215
+ readIni(ini: IniSection): this;
216
+ }
217
+
218
+ export declare class DMislRules extends MissileRules {
219
+ readIni(ini: IniSection): this;
220
+ }
221
+
222
+ export declare interface FactoryData {
223
+ status: FactoryStatus;
224
+ /** The unit currently being delivered by the factory, if its status is {@link FactoryStatus.Delivering} */
225
+ deliveringUnit: number | undefined;
226
+ }
227
+
228
+ export declare enum FactoryStatus {
229
+ Idle = 0,
230
+ Delivering = 1
231
+ }
232
+
233
+ export declare enum FactoryType {
234
+ None = 0,
235
+ BuildingType = 1,
236
+ InfantryType = 2,
237
+ /**
238
+ * Includes only ground vehicles or those considered as aircrafts which are produces from a war factory.
239
+ * Unlike original game, naval factory type is now split into its own type.
240
+ */
241
+ UnitType = 3,
242
+ /** Original game uses a single UnitType for both naval and non-naval units */
243
+ NavalUnitType = 4,
244
+ AircraftType = 5
245
+ }
246
+
247
+ export declare class GameApi {
248
+ #private;
249
+ mapApi: MapApi;
250
+ rulesApi: RulesApi;
251
+ isPlayerDefeated(playerName: string): boolean;
252
+ areAlliedPlayers(p1Name: string, p2Name: string): boolean;
253
+ canPlaceBuilding(playerName: string, buildingName: string, tile: Tile): boolean;
254
+ getBuildingPlacementData(objName: string): BuildingPlacementData;
255
+ getPlayers(): string[];
256
+ getPlayerData(playerName: string): PlayerData;
257
+ getAllTerrainObjects(): number[];
258
+ getAllUnits(): number[];
259
+ /**
260
+ * Gets a list of units which are visible to the given player (not under the shroud), based on hostility
261
+ *
262
+ * An additional filter predicate can be passed to further narrow down results
263
+ */
264
+ getVisibleUnits(playerName: string, type: "self" | "allied" | "hostile", filter?: (r: TechnoRules) => boolean): number[];
265
+ getGameObjectData(objId: number): GameObjectData | undefined;
266
+ getUnitData(unitId: number): UnitData | undefined;
267
+ getAllSuperWeaponData(): SuperWeaponData[];
268
+ /** Returns a data structure that wraps the rules.ini [General] section */
269
+ getGeneralRules(): GeneralRules;
270
+ getRulesIni(): IniFile;
271
+ getArtIni(): IniFile;
272
+ /**
273
+ * Generates a random integer in the specified [min, max] interval using the internal PRNG.
274
+ * Must be used instead of Math.random() when computing game state to prevent desyncs between clients
275
+ */
276
+ generateRandomInt(min: number, max: number): number;
277
+ /**
278
+ * Generates a random float in the [0,1) interval using the internal PRNG.
279
+ * Must be used instead of Math.random() when computing game state to prevent desyncs between clients
280
+ */
281
+ generateRandom(): number;
282
+ /** Current game speed in ticks/second. IMPORTANT: The game speed can change during a game */
283
+ getTickRate(): number;
284
+ getCurrentTick(): number;
285
+ }
286
+
287
+ export declare class GameInstanceApi {
288
+ #private;
289
+ isFinished(): boolean;
290
+ /** Advances the game turn in offline mode or waits for the next turn in online mode */
291
+ update(): Promise<void>;
292
+ getCurrentTick(): number;
293
+ getTickRate(): number;
294
+ getPlayerStats(): PlayerStats[];
295
+ saveReplay(targetDir?: string): void;
296
+ dispose(): void;
297
+ }
298
+
299
+ export declare interface GameObjectData {
300
+ id: number;
301
+ type: ObjectType;
302
+ /** The name of the object, given by its rules.ini section label */
303
+ name: string;
304
+ /** Data structure that corresponds to the rules.ini section for this object type */
305
+ rules: ObjectRules;
306
+ /** What tile the object is currently on. If the object occupies more than one tile, this is the top-most tile */
307
+ tile: Tile;
308
+ /** The object position in world space */
309
+ worldPosition: THREE.Vector3;
310
+ /** The object elevation above the ground, in Z levels */
311
+ tileElevation: number;
312
+ /** The size in tiles occupied by this object */
313
+ foundation: Size;
314
+ /** The current HP */
315
+ hitPoints?: number;
316
+ /** The maximum HP */
317
+ maxHitPoints?: number;
318
+ }
319
+
320
+ export declare class GeneralRules {
321
+ aircraftFogReveal: number;
322
+ alliedDisguise: string;
323
+ baseUnit: string[];
324
+ bridgeVoxelMax: number;
325
+ /** general build speed [time (in minutes) to produce a 1000 credit cost item] */
326
+ buildSpeed: number;
327
+ /** Average minutes that building build-up animation runs */
328
+ buildupTime: number;
329
+ chronoDelay: number;
330
+ chronoDistanceFactor: number;
331
+ chronoHarvTooFarDistance: number;
332
+ chronoMinimumDelay: number;
333
+ chronoRangeMinimum: number;
334
+ chronoTrigger: boolean;
335
+ cliffBackImpassability: number;
336
+ cloakDelay: number;
337
+ closeEnough: number;
338
+ crew: CrewRules;
339
+ defaultMirageDisguises: string[];
340
+ dMisl: DMislRules;
341
+ engineer: string;
342
+ flightLevel: number;
343
+ guardAreaTargetingDelay: number;
344
+ harvesterTooFarDistance: number;
345
+ harvesterUnit: string[];
346
+ hover: HoverRules;
347
+ infantryBlinkDisguiseTime: number;
348
+ lightningStorm: LightningStormRules;
349
+ lowPowerPenaltyModifier: number;
350
+ minLowPowerProductionSpeed: number;
351
+ maxLowPowerProductionSpeed: number;
352
+ maximumCheerRate: number;
353
+ maximumQueuedObjects: number;
354
+ maxWaypointPathLength: number;
355
+ multipleFactory: number;
356
+ /** Used to provide explicit control of targeting rates in frames, when not engaged in a mission or AI trigger. */
357
+ normalTargetingDelay: number;
358
+ padAircraft: string[];
359
+ /** Fall speed in cells / second */
360
+ parachuteMaxFallRate: number;
361
+ paradrop: ParadropRules;
362
+ prereqCategories: Map<PrereqCategory, string[]>;
363
+ prism: PrismRules;
364
+ purifierBonus: number;
365
+ radar: RadarRules;
366
+ refundPercent: number;
367
+ repair: RepairRules;
368
+ shipSinkingWeight: number;
369
+ sovietDisguise: string;
370
+ spyMoneyStealPercent: number;
371
+ spyPowerBlackout: number;
372
+ technician: string;
373
+ threat: ThreatRules;
374
+ treeStrength: number;
375
+ v3Rocket: V3RocketRules;
376
+ veteran: VeteranRules;
377
+ wallBuildSpeedCoefficient: number;
378
+ readIni(ini: IniSection): void;
379
+ private readPrereqCategories;
380
+ getMissileRules(type: string): V3RocketRules | DMislRules;
381
+ }
382
+
383
+ export declare class HoverRules {
384
+ height: number;
385
+ dampen: number;
386
+ bob: number;
387
+ boost: number;
388
+ acceleration: number;
389
+ brake: number;
390
+ readIni(ini: IniSection): this;
391
+ }
392
+
393
+ /** Infantry death types, based on warhead */
394
+ export declare enum InfDeathType {
395
+ None = 0,
396
+ /** Twirl death (plays Die1 sequence) */
397
+ Gunfire = 1,
398
+ /** High explosive death (plays Die2 seq) */
399
+ Explode = 2,
400
+ /** Flying death (armor piercing). Plays anim specified by "InfantryExplode" in rules.ini */
401
+ ExplodeAlt = 3,
402
+ /** Burn death. Plays animation specified by "FlamingInfantry" in rules.ini */
403
+ Fire = 4,
404
+ /** Electro death. Plays animation specified by 2nd item in rules.ini [Animations] array */
405
+ Electro = 5,
406
+ /** Yuri deployed death. Plays animation specified by "InfantryHeadPop" */
407
+ HeadExplode = 6,
408
+ /** Nuke death. Plays animation specified by "InfantryNuked" */
409
+ Nuke = 7
410
+ }
411
+
412
+ export declare class IniFile {
413
+ private sections;
414
+ fromString(data: string): this;
415
+ fromJson(data: Record<string, unknown>): void;
416
+ toString(): string;
417
+ clone(): IniFile;
418
+ getOrCreateSection(name: string): IniSection;
419
+ getSection(name: string): IniSection | undefined;
420
+ getOrderedSections(): IniSection[];
421
+ private isValueArray;
422
+ mergeWith(ini: IniFile): this;
423
+ }
424
+
425
+ export declare class IniSection {
426
+ name: string;
427
+ entries: Map<string, string>;
428
+ constructor(name: string);
429
+ clone(): IniSection;
430
+ set(name: string, value: string): void;
431
+ get(name: string): string | undefined;
432
+ has(name: string): boolean;
433
+ getString(name: string, defaultValue?: string): string;
434
+ getNumber(key: string, defaultValue?: number): number;
435
+ /**
436
+ * Parses an integer, decimal number (e.g. "1.23" or ".2") or percent value (e.g "20%") string into a regular
437
+ * JavaScript IEEE 754 floating-point number representation
438
+ */
439
+ private parseNumber;
440
+ /**
441
+ * Reads a decimal number (e.g. "1.23" or ".2") or percent value (e.g "20%") string into a regular JavaScript
442
+ * IEEE 754 floating-point representation, but emulates fixed-point precision.
443
+ *
444
+ * See https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/FIXED.CPP
445
+ */
446
+ getFixed(key: string, defaultValue?: number): number;
447
+ /** Emulates fixed-point precision given a floating-point number */
448
+ private toFixedPointPrecision;
449
+ getBool(key: string, defaultValue?: boolean): boolean;
450
+ getArray(key: string, sep?: RegExp, defaultValue?: never[]): string[];
451
+ getNumberArray(key: string, sep?: RegExp, defaultValue?: number[]): number[];
452
+ getFixedArray(key: string, sep?: RegExp, defaultValue?: number[]): number[];
453
+ getEnum<T>(key: string, enumType: any, defaultValue: T, caseInsensitive?: boolean): T;
454
+ getEnumArray<T>(key: string, enumType: any, sep?: RegExp, defaultValue?: T[], caseInsensitive?: boolean): T[];
455
+ getHighestNumericIndex(): number;
456
+ getConcatenatedValues(): string;
457
+ toString(): string;
458
+ }
459
+
460
+ export declare interface IsoTile {
461
+ dx: number;
462
+ dy: number;
463
+ rx: number;
464
+ ry: number;
465
+ z: number;
466
+ tileNum: number;
467
+ subTile: number;
468
+ }
469
+
470
+ export declare enum LandTargeting {
471
+ LandOk = 0,
472
+ LandNotOk = 1,
473
+ /** Can shoot land, but only with secondary weapon */
474
+ LandSecondary = 2
475
+ }
476
+
477
+ export declare enum LandType {
478
+ /** normal clear terrain */
479
+ Clear = 0,
480
+ /** roads (both dirt and paved) */
481
+ Road = 1,
482
+ /** rocky terrain (including rocks themselves) */
483
+ Rock = 2,
484
+ /** where water joins land */
485
+ Beach = 3,
486
+ /** rough terrain (debris for example) */
487
+ Rough = 4,
488
+ /** ice covering water (although this may be disabled in Red Alert 2) */
489
+ /** Train tracks (works in Tiberian Sun, in Red Alert 2 requires Terrain Expansion (aka TX)). */
490
+ Railroad = 5,
491
+ /** Tunnel entrance/exit (works in Tiberian Sun, in Red Alert 2 requires Terrain Expansion (aka TX)). */
492
+ /** Tiberium Veins (Works in TS, in RA2 it is not assigned to anything and can be used for new movement rules). */
493
+ /** Water as in lakes or ocean areas. */
494
+ Water = 6,
495
+ /** Non-firestorm/non-laserfence walls. */
496
+ Wall = 7,
497
+ /** Ore/Gem/Tiberium overlays. */
498
+ Tiberium = 8,
499
+ /** Cliffs (before Red Alert 2 Rock was used for cliffs). */
500
+ Cliff = 9
501
+ }
502
+
503
+ export declare class LightningStormRules {
504
+ deferment: number;
505
+ damage: number;
506
+ duration: number;
507
+ warhead: string;
508
+ hitDelay: number;
509
+ scatterDelay: number;
510
+ cellSpread: number;
511
+ separation: number;
512
+ readIni(ini: IniSection): this;
513
+ }
514
+
515
+ export declare enum LocomotorType {
516
+ Statue = 0,
517
+ Aircraft = 1,
518
+ Chrono = 2,
519
+ Hover = 3,
520
+ Infantry = 4,
521
+ Jumpjet = 5,
522
+ Missile = 6,
523
+ Ship = 7,
524
+ Vehicle = 8
525
+ }
526
+
527
+ export declare class MapApi {
528
+ #private;
529
+ /** Tile coordinates for each player starting position */
530
+ getStartingLocations(): Point2D[];
531
+ getTheaterType(): TheaterType;
532
+ getTile(rx: number, ry: number): Tile | undefined;
533
+ getTilesInRect(baseTile: Tile, size: Size): Tile[];
534
+ getObjectsOnTile(tile: Tile): number[];
535
+ hasBridgeOnTile(tile: Tile): boolean;
536
+ hasHighBridgeOnTile(tile: Tile): boolean;
537
+ isPassableTile(tile: Tile, speedType: SpeedType, onBridge: boolean): boolean;
538
+ /** If the tile is not covered by shroud for the specified player */
539
+ isVisibleTile(tile: Tile, playerName: string): boolean;
540
+ getTileResourceData(tile: Tile): TileResourceData | undefined;
541
+ getAllTilesResourceData(): TileResourceData[];
542
+ }
543
+
544
+ export declare class MissileRules {
545
+ /** How many frames the rocket pauses on the launcher before tilting */
546
+ pauseFrames: number;
547
+ /** How many frames it takes for the V3 rocket to tilt to firing position */
548
+ tiltFrames: number;
549
+ /** Starting pitch of the rocket before tilting up (0=horizontal,1=vertical) */
550
+ pitchInitial: number;
551
+ /** Ending pitch of the rocket after tilting up; now it fires */
552
+ pitchFinal: number;
553
+ /** Pitch maneuverability of rocket in air. Adjust by trial and error. */
554
+ turnRate: number;
555
+ /** This much is added to the rocket's velocity each frame during launch */
556
+ acceleration: number;
557
+ /** Cruising altitude in leptons: at this height rocket BEGINS leveling off */
558
+ altitude: number;
559
+ /** Exploding V3 does this much damage (at center of explosion, presumably). */
560
+ damage: number;
561
+ /** Exploding V3 does this much damage (at center of explosion, presumably). */
562
+ eliteDamage: number;
563
+ /** The body of the rocket is this many leptons long */
564
+ bodyLength: number;
565
+ /** The rocket's path is a big, lazy curve. V3 yes. DMisl no. */
566
+ lazyCurve: boolean;
567
+ type: string;
568
+ }
569
+
570
+ export declare enum MovementZone {
571
+ /** when pathfinding, the unit will consider both ground and water as passable. */
572
+ Amphibious = 0,
573
+ /**
574
+ * When pathfinding, the unit will consider both ground and water as passible.
575
+ * In addition, it will assume that it is capable of crushing infantry, but is unarmed.1.
576
+ */
577
+ AmphibiousCrusher = 1,
578
+ /**
579
+ * Same as above, additionally can destroy terrain obstacles.
580
+ * In RA2 this is tied to being an amphibious infantry.
581
+ */
582
+ AmphibiousDestroyer = 2,
583
+ /**
584
+ * when pathfinding, only clear ground is considered passable.
585
+ * Also assumes that it can crush infantry, but is not armed.1
586
+ */
587
+ Crusher = 3,
588
+ /** Same as above, additionally assumes that it can crush any mobile object, as well as walls. 2 */
589
+ CrusherAll = 4,
590
+ /** when pathfinding, considers ground passable. Can destroy terrain obstacles and crush infantry obstacles. */
591
+ Destroyer = 5,
592
+ /** when pathfinding, it assumes everything passable. */
593
+ Fly = 6,
594
+ /** when pathfinding, only clear ground is considered passable. */
595
+ Infantry = 7,
596
+ /** Same as above, but can destroy terrain obstacles such as trees. */
597
+ InfantryDestroyer = 8,
598
+ /**
599
+ * when pathfinding, considers clear ground passable.
600
+ * Assumes it can destroy terrain obstacles and crush infantry.
601
+ */
602
+ Normal = 9,
603
+ /**
604
+ * when pathfinding, considers clear ground passable.
605
+ * When destination is too far away for surface travel, or there is an obstacle in the way,
606
+ * unit will dig underground. Unit cannot dig on pavement.
607
+ * In other cases, when subterranean travel is not possible, or surface travel is quicker,
608
+ * acts like a unit with MovementZone=Crusher or MovementZone=Destroyer.
609
+ */
610
+ Subterranean = 10,
611
+ /** when pathfinding, considers only water as passable. */
612
+ Water = 11
613
+ }
614
+
615
+ export declare enum NavalTargeting {
616
+ /** Can't shoot at all at underwater */
617
+ UnderwaterNever = 0,
618
+ /** Use Second weapon against underwater */
619
+ UnderwaterSecondary = 1,
620
+ /** Can only shoot underwater */
621
+ UnderwaterOnly = 2,
622
+ /** Use second Weapon on organic */
623
+ OrganicSecondary = 3,
624
+ /** Primary on Amphibious and organic, Second on Naval and underwater-not-organic */
625
+ SealSpecial = 4,
626
+ /** Go ahead and shoot everything with Primary */
627
+ NavalAll = 5,
628
+ /** Don't even shoot into the water */
629
+ NavalNone = 6
630
+ }
631
+
632
+ export declare interface ObjectDestroyApiEvent {
633
+ type: ApiEventType.ObjectDestroy;
634
+ target: number;
635
+ attackerInfo: {
636
+ playerName: string;
637
+ objId?: number;
638
+ weaponName?: string;
639
+ } | undefined;
640
+ }
641
+
642
+ export declare interface ObjectOwnerChangeApiEvent {
643
+ type: ApiEventType.ObjectOwnerChange;
644
+ target: number;
645
+ prevOwnerName: string;
646
+ newOwnerName: string;
647
+ }
648
+
649
+ /** Base class for rules.ini game entity sections */
650
+ export declare class ObjectRules {
651
+ type: ObjectType;
652
+ protected ini: IniSection;
653
+ static readonly IMAGE_NONE = "none";
654
+ alphaImage: string | undefined;
655
+ /** Only for SHP-based entities */
656
+ alternateArcticArt: boolean;
657
+ crushable: boolean;
658
+ crushSound: string | undefined;
659
+ dontScore: boolean;
660
+ /** Makes the object ignored for scoring and killing purposes */
661
+ insignificant: boolean;
662
+ /** If this object can be targeted or fired upon */
663
+ legalTarget: boolean;
664
+ /** This is an override for art.ini Shadow */
665
+ noShadow: boolean;
666
+ uiName: string;
667
+ static iniSpeedToLeptonsPerTick(iniSpeed: number): number;
668
+ static iniRotToDegsPerTick(iniRot: number): number;
669
+ constructor(type: ObjectType, ini: IniSection);
670
+ protected parse(): void;
671
+ get name(): string;
672
+ get imageName(): string;
673
+ }
674
+
675
+ export declare interface ObjectSpawnUnspawnApiEvent {
676
+ type: ApiEventType.ObjectSpawn | ApiEventType.ObjectUnspawn;
677
+ target: number;
678
+ }
679
+
680
+ export declare enum ObjectType {
681
+ None = 0,
682
+ Aircraft = 1,
683
+ Building = 2,
684
+ Infantry = 3,
685
+ Overlay = 4,
686
+ Smudge = 5,
687
+ Terrain = 6,
688
+ Vehicle = 7,
689
+ Animation = 8,
690
+ Projectile = 9,
691
+ VoxelAnim = 10,
692
+ Debris = 11
693
+ }
694
+
695
+ export declare enum OrderType {
696
+ Move = 0,
697
+ ForceMove = 1,
698
+ Attack = 2,
699
+ ForceAttack = 3,
700
+ AttackMove = 4,
701
+ Guard = 5,
702
+ GuardArea = 6,
703
+ Capture = 7,
704
+ Occupy = 8,
705
+ Deploy = 9,
706
+ DeploySelected = 10,
707
+ Stop = 11,
708
+ Cheer = 12,
709
+ Dock = 13,
710
+ Gather = 14,
711
+ Repair = 15,
712
+ Scatter = 16,
713
+ EnterTransport = 17,
714
+ PlaceBomb = 18
715
+ }
716
+
717
+ /** Data structure for rules.ini overlay types */
718
+ export declare class OverlayRules extends ObjectRules {
719
+ armor: ArmorType;
720
+ crate: boolean;
721
+ isARock: boolean;
722
+ /** See https://www.modenc.renegadeprojects.com/IsRubble */
723
+ isRubble: boolean;
724
+ isVeinholeMonster: boolean;
725
+ isVeins: boolean;
726
+ /** Only for overlays - Specifies the type of land that this overlay forms when placed on the map. */
727
+ land: LandType;
728
+ noUseTileLandType: boolean;
729
+ radarInvisible: boolean;
730
+ strength: number;
731
+ tiberium: boolean;
732
+ wall: boolean;
733
+ protected parse(): void;
734
+ }
735
+
736
+ export declare class ParadropRules {
737
+ allyParaDrop: ParadropSquad[];
738
+ amerParaDrop: ParadropSquad[];
739
+ paradropPlane: string;
740
+ /** In leptons */
741
+ paradropRadius: number;
742
+ sovParaDrop: ParadropSquad[];
743
+ readIni(ini: IniSection): this;
744
+ private readParadropSquad;
745
+ getParadropSquads(sideType: SideType): ParadropSquad[];
746
+ }
747
+
748
+ export declare interface ParadropSquad {
749
+ /** Infantry name */
750
+ inf: string;
751
+ /** Number of units to drop */
752
+ num: number;
753
+ }
754
+
755
+ export declare enum PipColor {
756
+ Green = 0,
757
+ Yellow = 1,
758
+ White = 2,
759
+ Red = 3,
760
+ Blue = 4
761
+ }
762
+
763
+ export declare interface PlayerData {
764
+ name: string;
765
+ country: Country | undefined;
766
+ /** The starting tile coordinates for the player (where the initial MCV is placed) */
767
+ startLocation: Point2D;
768
+ isObserver: boolean;
769
+ /** Whether the player is an integrated AI. Not applicable to sandbox agents. */
770
+ isAi: boolean;
771
+ /** Whether the player is not an observer and hasn't been defeated */
772
+ isCombatant: boolean;
773
+ credits: number;
774
+ power: PowerData;
775
+ radarDisabled: boolean;
776
+ }
777
+
778
+ export declare interface PlayerStats {
779
+ name: string;
780
+ country: Country;
781
+ ai: boolean;
782
+ defeated: boolean;
783
+ credits: number;
784
+ startLocation: number;
785
+ }
786
+
787
+ export declare interface Point2D {
788
+ x: number;
789
+ y: number;
790
+ }
791
+
792
+ export declare interface PowerData {
793
+ /** Total power generated by buildings such as power plants */
794
+ total: number;
795
+ /** How much power is consumed */
796
+ drain: number;
797
+ /** If the base is on low power (e.g. the power drain is larger than the generated power, or power sabotaged) */
798
+ isLowPower: boolean;
799
+ }
800
+
801
+ export declare enum PrereqCategory {
802
+ Power = 0,
803
+ Factory = 1,
804
+ Barracks = 2,
805
+ Radar = 3,
806
+ Tech = 4,
807
+ Proc = 5
808
+ }
809
+
810
+ export declare class PrismRules {
811
+ type: string;
812
+ supportHeight: number;
813
+ supportMax: number;
814
+ supportModifier: number;
815
+ readIni(ini: IniSection): this;
816
+ }
817
+
818
+ export declare class ProductionApi {
819
+ #private;
820
+ isAvailableForProduction(objRules: TechnoRules): boolean;
821
+ getAvailableObjects(queueType?: QueueType): TechnoRules[];
822
+ getQueueTypeForObject(objRules: TechnoRules): QueueType;
823
+ getQueueData(queueType: QueueType): QueueData;
824
+ }
825
+
826
+ export declare class ProjectileRules extends ObjectRules {
827
+ acceleration: number;
828
+ arcing: boolean;
829
+ courseLockDuration: number;
830
+ detonationAltitude: number;
831
+ /**
832
+ * If set, the projectile will be drawn in the unit palette regardless of the settings in projectile image code.
833
+ * This also makes the projectile remappable.
834
+ */
835
+ firersPalette: boolean;
836
+ flakScatter: boolean;
837
+ inaccurate: boolean;
838
+ inviso: boolean;
839
+ isAntiAir: boolean;
840
+ /** No = can't force fire at ground, but can still attack objects on the ground, unless LandTargeting=1 */
841
+ isAntiGround: boolean;
842
+ level: boolean;
843
+ /** Rate of turn in degs/tick */
844
+ rot: number;
845
+ /** Original ROT value from INI */
846
+ iniRot: number;
847
+ shrapnelWeapon: string | undefined;
848
+ shrapnelCount: number;
849
+ subjectToCliffs: boolean;
850
+ subjectToElevation: boolean;
851
+ subjectToWalls: boolean;
852
+ vertical: boolean;
853
+ protected parse(): void;
854
+ }
855
+
856
+ export declare class PublicApi {
857
+ #private;
858
+ init(mixDir: string): Promise<void>;
859
+ getAvailableMaps(): string[];
860
+ getAvailableGameModes(mapName: string): number[];
861
+ /**
862
+ * Creates a new game
863
+ *
864
+ * If {@link CreateOfflineOpts.online} is false, an offline game is created, in which multiple AI agents can battle
865
+ * each other in a sandboxed environment. The game simulation runs programatically at the fastest possible speed.
866
+ *
867
+ * If {@link CreateOnlineOpts.online} is true, an online game is created, in which human players can fight
868
+ * in real time against the AI.
869
+ *
870
+ * In online mode, the {@link CreateOnlineOpts.agents} array specifies both human and AI agents. In this case,
871
+ * there can be only one AI agent (the game host) and it must be the first item in the array.
872
+ */
873
+ createGame(opts: CreateOpts): Promise<GameInstanceApi>;
874
+ }
875
+
876
+ export declare interface QueueData {
877
+ size: number;
878
+ maxSize: number;
879
+ status: QueueStatus;
880
+ type: QueueType;
881
+ items: QueueItemData[];
882
+ }
883
+
884
+ export declare interface QueueItemData {
885
+ rules: TechnoRules;
886
+ quantity: number;
887
+ }
888
+
889
+ export declare enum QueueStatus {
890
+ Idle = 0,
891
+ Active = 1,
892
+ /** Production is paused */
893
+ OnHold = 2,
894
+ /** First item is ready and is waiting to be removed before starting the next */
895
+ Ready = 3
896
+ }
897
+
898
+ export declare enum QueueType {
899
+ Structures = 0,
900
+ Armory = 1,
901
+ Infantry = 2,
902
+ Vehicles = 3,
903
+ Aircrafts = 4,
904
+ Ships = 5
905
+ }
906
+
907
+ export declare enum RadarEventType {
908
+ GenericCombat = 0,
909
+ GenericNonCombat = 1,
910
+ DropZone = 2,
911
+ BaseUnderAttack = 3,
912
+ HarvesterUnderAttack = 4,
913
+ EnemyObjectSensed = 5
914
+ }
915
+
916
+ export declare class RadarRules {
917
+ /** suppression distance in cells */
918
+ private eventSuppressionDistances;
919
+ /** event visibility in frames */
920
+ private eventVisibilityDurations;
921
+ /** event duration in frames */
922
+ private eventDurations;
923
+ flashFrameTime: number;
924
+ combatFlashTime: number;
925
+ eventMinRadius: number;
926
+ eventSpeed: number;
927
+ eventRotationSpeed: number;
928
+ eventColorSpeed: number;
929
+ readIni(ini: IniSection): this;
930
+ getEventSuppresionDistance(type: RadarEventType): number;
931
+ getEventVisibilityDuration(type: RadarEventType): number;
932
+ getEventDuration(type: RadarEventType): number;
933
+ }
934
+
935
+ export declare class RadiationRules {
936
+ /**
937
+ * Number of frames site lasts per level of radiation.
938
+ *
939
+ * When rad level goes to zero, rad site deletes itself.
940
+ * --&gt; Site lasts ( Level x RadDurationMultiple ) frames.
941
+ * For reference, the Nuke puts down 2000 units of radiation.
942
+ * A mult. of 3 frames means the rad site is active for 6000
943
+ * frames -- something over 3 minutes at 30 Hz.
944
+ */
945
+ radDurationMultiple: number;
946
+ /** Delay between times when radiation is applied to units. */
947
+ radApplicationDelay: number;
948
+ /**
949
+ * Maximum radiation allowable in a cell. The cell can actually have more radiation
950
+ * but it will only damage as if it had the maximum level.
951
+ */
952
+ radLevelMax: number;
953
+ /**
954
+ * Delay in frames between radiation level decrements.
955
+ *
956
+ * The level updates this often, but the rate is still as specified
957
+ * in RadDurationMultiple.
958
+ */
959
+ radLevelDelay: number;
960
+ /**
961
+ * Delay in frames between radiation lighting intensity decrements.
962
+ * This should never be less than the RadLevelDelay, as it will
963
+ * produce no visual benefit and just waste processor cycles.
964
+ */
965
+ radLightDelay: number;
966
+ /** Scales damage done by a given radiation level. */
967
+ radLevelFactor: number;
968
+ /** Scales the factor brightness plays in the radiation display. */
969
+ radLightFactor: number;
970
+ /** Scales the factor tint plays in the radiation display. */
971
+ radTintFactor: number;
972
+ /** The color of the radiation. (0-255 rgb array) */
973
+ radColor: number[];
974
+ /** Sets the warhead used by irradiated tiles. */
975
+ radSiteWarhead: string;
976
+ readIni(ini: IniSection): void;
977
+ }
978
+
979
+ export declare class RepairRules {
980
+ /** minutes to reload each ammo point for aircraft or helicopters (also affects repair rate) */
981
+ reloadRate: number;
982
+ /** percent cost to fully repair as ratio of full cost */
983
+ repairPercent: number;
984
+ /** minutes between applying repair step */
985
+ repairRate: number;
986
+ /** hit points to heal per repair 'tick' */
987
+ repairStep: number;
988
+ /** [units only] minutes between applying repair step */
989
+ uRepairRate: number;
990
+ /** [infantry only] minutes between applying repair step */
991
+ iRepairRate: number;
992
+ /** [infantry only] hit points to heal per repair 'tick' for infantry */
993
+ iRepairStep: number;
994
+ readIni(ini: IniSection): this;
995
+ }
996
+
997
+ export declare class RulesApi {
998
+ #private;
999
+ get allObjectRules(): Map<ObjectType, Map<string, ObjectRules>>;
1000
+ get buildingRules(): Map<string, TechnoRules>;
1001
+ get infantryRules(): Map<string, TechnoRules>;
1002
+ get vehicleRules(): Map<string, TechnoRules>;
1003
+ get aircraftRules(): Map<string, TechnoRules>;
1004
+ get terrainRules(): Map<string, TerrainRules>;
1005
+ get overlayRules(): Map<string, OverlayRules>;
1006
+ get countryRules(): Map<string, CountryRules>;
1007
+ get general(): GeneralRules;
1008
+ get ai(): AiRules;
1009
+ get crateRules(): CrateRules;
1010
+ get combatDamage(): CombatDamageRules;
1011
+ get radiation(): RadiationRules;
1012
+ hasObject(name: string, type: ObjectType): boolean | undefined;
1013
+ getObject(name: string, type: ObjectType): ObjectRules;
1014
+ getBuilding(name: string): TechnoRules;
1015
+ getWeapon(name: string): WeaponRules;
1016
+ getWarhead(name: string): WarheadRules;
1017
+ getProjectile(name: string): ProjectileRules;
1018
+ getOverlayName(id: number): string;
1019
+ getOverlayId(name: string): number;
1020
+ getOverlay(name: string): OverlayRules;
1021
+ getCountry(name: string): CountryRules;
1022
+ getMultiplayerCountries(): CountryRules[];
1023
+ getIni(): IniFile;
1024
+ }
1025
+
1026
+ /** Side/faction types (ally/soviet). Relic naming since tiberian sun */
1027
+ export declare enum SideType {
1028
+ GDI = 0,
1029
+ Nod = 1,
1030
+ Civilian = 2,
1031
+ Mutant = 3
1032
+ }
1033
+
1034
+ export declare interface Size {
1035
+ width: number;
1036
+ height: number;
1037
+ }
1038
+
1039
+ export declare enum SpeedType {
1040
+ Foot = 0,
1041
+ Track = 1,
1042
+ Wheel = 2,
1043
+ Hover = 3,
1044
+ Float = 4,
1045
+ FloatBeach = 5,
1046
+ Amphibious = 6,
1047
+ Winged = 7
1048
+ }
1049
+
1050
+ export declare enum StanceType {
1051
+ None = 0,
1052
+ Guard = 1,
1053
+ Prone = 2,
1054
+ Deployed = 3,
1055
+ Paradrop = 4,
1056
+ Cheer = 5
1057
+ }
1058
+
1059
+ export declare interface SuperWeaponData {
1060
+ playerName: string;
1061
+ type: SuperWeaponType;
1062
+ status: SuperWeaponStatus;
1063
+ timerSeconds: number;
1064
+ }
1065
+
1066
+ export declare enum SuperWeaponStatus {
1067
+ Charging = 0,
1068
+ Paused = 1,
1069
+ Ready = 2
1070
+ }
1071
+
1072
+ export declare enum SuperWeaponType {
1073
+ MultiMissile = 0,
1074
+ IronCurtain = 1,
1075
+ LightningStorm = 2,
1076
+ ChronoSphere = 3,
1077
+ ChronoWarp = 4,
1078
+ ParaDrop = 5,
1079
+ AmerParaDrop = 6
1080
+ }
1081
+
1082
+ /** Data structure for rules.ini tehno types sections (buildings, infantry, vehicles, aircrafts) */
1083
+ export declare class TechnoRules extends ObjectRules {
1084
+ static readonly MAX_SIGHT = 11;
1085
+ /** Magic number that corrects infantry/projectile speed relative to vehicles */
1086
+ static readonly MAGIC_SPEED_MULT = 0.65;
1087
+ /** Countries that can build this */
1088
+ owner: string[];
1089
+ /** Side that building belongs to; should match SideType enum values */
1090
+ aiBasePlanningSide: SideType | undefined;
1091
+ /** Building category - used for sidebar placement */
1092
+ buildCat: BuildCat;
1093
+ /** -1 = can't build */
1094
+ techLevel: number;
1095
+ prerequisite: string[];
1096
+ private requiredHouses;
1097
+ private forbiddenHouses;
1098
+ requiresStolenAlliedTech: boolean;
1099
+ requiresStolenSovietTech: boolean;
1100
+ cost: number;
1101
+ points: number;
1102
+ soylent: number;
1103
+ crateGoodie: boolean;
1104
+ /**
1105
+ * Only for buildings
1106
+ * Positive values indicate that it produces power (e.g. a Power Plant) and
1107
+ * negative values indicate that it uses (drains) power.
1108
+ */
1109
+ power: number;
1110
+ /** Only for buildings */
1111
+ powered: boolean;
1112
+ /** Max placement distance from other buildings */
1113
+ adjacent: number;
1114
+ /** Considered for adjacency checks? */
1115
+ baseNormal: boolean;
1116
+ /**
1117
+ * How many can be built
1118
+ *
1119
+ * Omit = no limit;
1120
+ * 0 = only AI allowed to build, don't show in sidebar;
1121
+ * &lt;0 (UNSUPPORTED) = the absolute value limits the number of units that can be trained for the entire match
1122
+ */
1123
+ buildLimit: number;
1124
+ airRangeBonus: number;
1125
+ /**
1126
+ * For walls this is the connect distance. For other types overrides weapon range when scanning for targets.
1127
+ * Despite the name, this doesn't seem to be used in guard area mode
1128
+ */
1129
+ guardRange: number;
1130
+ defaultToGuardArea: boolean;
1131
+ /** Only for buildings */
1132
+ eligibileForAllyBuilding: boolean;
1133
+ numberImpassableRows: number;
1134
+ bridgeRepairHut: boolean;
1135
+ constructionYard: boolean;
1136
+ refinery: boolean;
1137
+ factory: FactoryType;
1138
+ weaponsFactory: boolean;
1139
+ helipad: boolean;
1140
+ hospital: boolean;
1141
+ unitRepair: boolean;
1142
+ unitReload: boolean;
1143
+ isBaseDefense: boolean;
1144
+ superWeapon: string;
1145
+ chargedAnimTime: number;
1146
+ naval: boolean;
1147
+ underwater: boolean;
1148
+ waterBound: boolean;
1149
+ orePurifier: boolean;
1150
+ cloning: boolean;
1151
+ nukeSilo: boolean;
1152
+ /** Only for buildings */
1153
+ repairable: boolean;
1154
+ /** Only for buildings */
1155
+ clickRepairable: boolean;
1156
+ unsellable: boolean;
1157
+ gdiBarracks: boolean;
1158
+ nodBarracks: boolean;
1159
+ numberOfDocks: number;
1160
+ landTargeting: LandTargeting;
1161
+ navalTargeting: NavalTargeting;
1162
+ tooBigToFitUnderBridge: boolean;
1163
+ canBeOccupied: boolean;
1164
+ maxNumberOccupants: number;
1165
+ leaveRubble: boolean;
1166
+ undeploysInto: string;
1167
+ deploysInto: string;
1168
+ capturable: boolean;
1169
+ spyable: boolean;
1170
+ needsEngineer: boolean;
1171
+ c4: boolean;
1172
+ /** Only for buildings */
1173
+ canC4: boolean;
1174
+ /** credits when captured from the Neutral house */
1175
+ produceCashStartup: number;
1176
+ /** Amount every Delay */
1177
+ produceCashAmount: number;
1178
+ /** Frame delay between Amounts */
1179
+ produceCashDelay: number;
1180
+ /** For infantry and vehicles */
1181
+ ifvMode: number;
1182
+ turretIndexesByIfvMode: Map<number, number>;
1183
+ turret: boolean;
1184
+ turretCount: number;
1185
+ explosion: string[];
1186
+ explodes: boolean;
1187
+ turretAnim: string;
1188
+ turretAnimIsVoxel: boolean;
1189
+ turretAnimX: number;
1190
+ turretAnimY: number;
1191
+ turretAnimZAdjust: number;
1192
+ isChargeTurret: boolean;
1193
+ overpowerable: boolean;
1194
+ freeUnit: string;
1195
+ primary: string | undefined;
1196
+ secondary: string | undefined;
1197
+ elitePrimary: string | undefined;
1198
+ eliteSecondary: string | undefined;
1199
+ /** Special weapon count. If greater than zero, (Elite)Weapon%d values are used over (Elite)Primary/Secondary */
1200
+ weaponCount: number;
1201
+ deathWeapon: string | undefined;
1202
+ deathWeaponDamageModifier: number;
1203
+ veteranAbilities: Set<VeteranAbility>;
1204
+ eliteAbilities: Set<VeteranAbility>;
1205
+ selfHealing: boolean;
1206
+ wall: boolean;
1207
+ gate: boolean;
1208
+ armor: ArmorType;
1209
+ strength: number;
1210
+ immune: boolean;
1211
+ immuneToRadiation: boolean;
1212
+ immuneToPsionics: boolean;
1213
+ typeImmune: boolean;
1214
+ warpable: boolean;
1215
+ /** Only for vehicles */
1216
+ isTilter: boolean;
1217
+ /** Only for shp vehicles */
1218
+ walkRate: number;
1219
+ /** Only for vehicles */
1220
+ idleRate: number;
1221
+ /** Only for vehicles that spawn child units */
1222
+ noSpawnAlt: boolean;
1223
+ /** Only for vehicles */
1224
+ crusher: boolean;
1225
+ /** Only for vehicles and infantry */
1226
+ consideredAircraft: boolean;
1227
+ /** Only for infantry and vehicles */
1228
+ crashable: boolean;
1229
+ /** Only for aircrafts or other objects that are considered aircraft */
1230
+ landable: boolean;
1231
+ /** Only for aicrafts */
1232
+ airportBound: boolean;
1233
+ /** Only for aircrafts or other objects that are considered aircraft */
1234
+ balloonHover: boolean;
1235
+ /** Only for aircrafts or other objects that are considered aircraft */
1236
+ hoverAttack: boolean;
1237
+ /** Only for aircrafts */
1238
+ omniFire: boolean;
1239
+ /** Only for aircrafts */
1240
+ fighter: boolean;
1241
+ /** Only for aircrafts */
1242
+ flightLevel: number | undefined;
1243
+ /** Only for vehicles, aircrafts and infantry */
1244
+ speedType: SpeedType | undefined;
1245
+ /** Speed in leptons/tick. Only for moving units */
1246
+ speed: number;
1247
+ /** Only for vehicles, aircrafts and infantry */
1248
+ locomotor: LocomotorType;
1249
+ movementZone: MovementZone;
1250
+ /** Only for infantry */
1251
+ fearless: boolean;
1252
+ /** Only for infantry and vehicles - if it has a deploy action */
1253
+ deployer: boolean;
1254
+ /** Only for infantry and vehicles */
1255
+ deployFire: boolean;
1256
+ /** Only for infantry and vehicles */
1257
+ deployFireWeapon: WeaponType;
1258
+ /** Only for infantry and vehicles */
1259
+ undeployDelay: number;
1260
+ /** Only for infantry - Can panic when attacked */
1261
+ fraidycat: boolean;
1262
+ /** Only for infantry */
1263
+ isHuman: boolean;
1264
+ /** Only for infantry */
1265
+ organic: boolean;
1266
+ /** Only for infantry */
1267
+ occupier: boolean;
1268
+ /** Only for infantry */
1269
+ engineer: boolean;
1270
+ /** Only for infantry */
1271
+ ivan: boolean;
1272
+ civilian: boolean;
1273
+ agent: boolean;
1274
+ infiltrate: boolean;
1275
+ threatPosed: number;
1276
+ specialThreatValue: number;
1277
+ canPassiveAquire: boolean;
1278
+ canRetaliate: boolean;
1279
+ /** Only for units */
1280
+ preventAttackMove: boolean;
1281
+ /** Only for units */
1282
+ opportunityFire: boolean;
1283
+ distributedFire: boolean;
1284
+ radialFireSegments: number;
1285
+ attackCursorOnFriendlies: boolean;
1286
+ bombable: boolean;
1287
+ /** Whether it can be promoted */
1288
+ trainable: boolean;
1289
+ /** (Not infantry) Specifies whether this object is occupied by infantry which can escape when it is destroyed */
1290
+ crewed: boolean;
1291
+ parasiteable: boolean;
1292
+ suppressionThreshold: number;
1293
+ reselectIfLimboed: boolean;
1294
+ rejoinTeamIfLimboed: boolean;
1295
+ /** Only for vehicles */
1296
+ weight: number;
1297
+ accelerates: boolean;
1298
+ accelerationFactor: number;
1299
+ /** Only for infantry and vehicles */
1300
+ teleporter: boolean;
1301
+ /** Only for infantry and vehicles */
1302
+ canDisguise: boolean;
1303
+ /** Only for infantry and vehicles */
1304
+ disguiseWhenStill: boolean;
1305
+ /** Only for infantry and vehicles */
1306
+ permaDisguise: boolean;
1307
+ detectDisguise: boolean;
1308
+ detectDisguiseRange: number;
1309
+ cloakable: boolean;
1310
+ sensors: boolean;
1311
+ sensorArray: boolean;
1312
+ sensorsSight: number;
1313
+ burstDelay: (number | undefined)[];
1314
+ vhpScan: VhpScan;
1315
+ /** Only for infantry */
1316
+ pip: PipColor;
1317
+ /** Only for vehicles - for PipScale=Passengers */
1318
+ passengers: number;
1319
+ /** Only for vehicles - considers the first passager as a gunner (affects turret and is evac'd separately) */
1320
+ gunner: boolean;
1321
+ ammo: number;
1322
+ initialAmmo: number;
1323
+ manualReload: boolean;
1324
+ /**
1325
+ * Only for vehicles - for PipScale=Tiberium
1326
+ *
1327
+ * Number of ore "bails" (1bail = $25/$50 see [Riparius] and [Cruentus])
1328
+ */
1329
+ storage: number;
1330
+ /** Only for aircraft - created by another object and therefore not player controllable */
1331
+ spawned: boolean;
1332
+ /** Only for vehicles - name of aircraft spawned by this unit */
1333
+ spawns: string;
1334
+ /** Only for vehicles - how many aircraft of "Spawns" type are spawned */
1335
+ spawnsNumber: number;
1336
+ /** Only for vehicles - the rate, in frames, at which this object regenerates spawned objects */
1337
+ spawnRegenRate: number;
1338
+ /** Only for vehicles - the rate, in frames, at which spawned are resupplied with ammo */
1339
+ spawnReloadRate: number;
1340
+ /** Only for aircrafts - marks as a missile spawned by another unit */
1341
+ missileSpawn: boolean;
1342
+ /** Storage space used inside a transport */
1343
+ size: number;
1344
+ /** Maximum size of a unit that is allowed to enter this unit as a passenger. */
1345
+ sizeLimit: number;
1346
+ sight: number;
1347
+ spySat: boolean;
1348
+ gapGenerator: boolean;
1349
+ gapRadiusInCells: number;
1350
+ psychicDetectionRadius: number;
1351
+ hasRadialIndicator: boolean;
1352
+ harvester: boolean;
1353
+ unloadingClass: string;
1354
+ /** What buildings can this unit type dock to? */
1355
+ dock: string[];
1356
+ /** Only for building types */
1357
+ radar: boolean;
1358
+ radarInvisible: boolean;
1359
+ /** Only for building types */
1360
+ revealToAll: boolean;
1361
+ selectable: boolean;
1362
+ isSelectableCombatant: boolean;
1363
+ /**
1364
+ * Only for buildings - Determines whether or not this object is invisible to all players ingame,
1365
+ * including the owner. It also cannot be targeted or destroyed by any other object on the map.
1366
+ */
1367
+ invisibleInGame: boolean;
1368
+ moveToShroud: boolean;
1369
+ leadershipRating: number;
1370
+ allowedToStartInMultiplayer: boolean;
1371
+ /** Rate of turn for unit body/turret in degrees/tick. Also see ROT */
1372
+ rot: number;
1373
+ jumpjetAccel: number;
1374
+ jumpjetClimb: number;
1375
+ jumpjetCrash: number;
1376
+ jumpjetDeviation: number;
1377
+ jumpjetHeight: number;
1378
+ jumpjetNoWobbles: boolean;
1379
+ jumpjetSpeed: number;
1380
+ jumpjetTurnRate: number;
1381
+ jumpjetWobbles: number;
1382
+ /** Only for aircraft */
1383
+ pitchAngle: number;
1384
+ /** Only for aircraft */
1385
+ pitchSpeed: number;
1386
+ damageParticleSystems: string[];
1387
+ damageSmokeOffset: THREE.Vector3;
1388
+ minDebris: number;
1389
+ maxDebris: number;
1390
+ /** Only for vehicles */
1391
+ debrisTypes: string[];
1392
+ /** Only for buildings */
1393
+ debrisAnims: string[];
1394
+ /** Only for lamps */
1395
+ isLightpost: boolean;
1396
+ /** Only for lamps */
1397
+ lightVisibility: number;
1398
+ /** Only for lamps */
1399
+ lightIntensity: number;
1400
+ /** Only for lamps */
1401
+ lightRedTint: number;
1402
+ /** Only for lamps */
1403
+ lightGreenTint: number;
1404
+ /** Only for lamps */
1405
+ lightBlueTint: number;
1406
+ ambientSound: string | undefined;
1407
+ createSound: string | undefined;
1408
+ deploySound: string | undefined;
1409
+ undeploySound: string | undefined;
1410
+ voiceSelect: string | undefined;
1411
+ voiceMove: string | undefined;
1412
+ voiceAttack: string | undefined;
1413
+ voiceFeedback: string | undefined;
1414
+ voiceSpecialAttack: string | undefined;
1415
+ voiceEnter: string | undefined;
1416
+ voiceCapture: string | undefined;
1417
+ voiceCrashing: string | undefined;
1418
+ crashingSound: string | undefined;
1419
+ impactLandSound: string | undefined;
1420
+ /** Take-off sound */
1421
+ auxSound1: string | undefined;
1422
+ /** Land sound */
1423
+ auxSound2: string | undefined;
1424
+ dieSound: string | undefined;
1425
+ moveSound: string | undefined;
1426
+ enterWaterSound: string | undefined;
1427
+ leaveWaterSound: string | undefined;
1428
+ turretRotateSound: string | undefined;
1429
+ workingSound: string | undefined;
1430
+ notWorkingSound: string | undefined;
1431
+ chronoInSound: string | undefined;
1432
+ chronoOutSound: string | undefined;
1433
+ enterTransportSound: string | undefined;
1434
+ leaveTransportSound: string | undefined;
1435
+ protected parse(): void;
1436
+ private parseTurretIndexes;
1437
+ private parseBurstDelay;
1438
+ /** If the specified country is listed as an Owner */
1439
+ hasOwner(country: Country): boolean;
1440
+ /** If the object is available to the specified country (meets the Required/ForbiddenHouses values) */
1441
+ isAvailableTo(country: Country): boolean;
1442
+ /** Only for infantry */
1443
+ get proneWhenAttacked(): boolean;
1444
+ getWeaponAtIndex(idx: number): string | undefined;
1445
+ getEliteWeaponAtIndex(idx: number): string | undefined;
1446
+ }
1447
+
1448
+ /** Data structure for rules.ini terrain types */
1449
+ export declare class TerrainRules extends ObjectRules {
1450
+ animationRate: number;
1451
+ animationProbability: number;
1452
+ gate: boolean;
1453
+ immune: boolean;
1454
+ isAnimated: boolean;
1455
+ radarInvisible: boolean;
1456
+ snowOccupationBits: number;
1457
+ spawnsTiberium: boolean;
1458
+ strength: number;
1459
+ temperateOccupationBits: number;
1460
+ protected parse(): void;
1461
+ private normalizeOccupationBits;
1462
+ getOccupationBits(theaterType: TheaterType): number;
1463
+ /** List of sub-cells that are occupied by this object */
1464
+ getOccupiedSubCells(theaterType: TheaterType): number[];
1465
+ }
1466
+
1467
+ export declare enum TerrainType {
1468
+ Default = 0,
1469
+ Tunnel = 5,
1470
+ Railroad = 6,
1471
+ Rock1 = 7,
1472
+ Rock2 = 8,
1473
+ Water = 9,
1474
+ Shore = 10,
1475
+ /** Paved road, bridge start (paved?), paved road, pavement detail, wood bridge start */
1476
+ Pavement = 11,
1477
+ /** Dirt road */
1478
+ Dirt = 12,
1479
+ /** Snow, grass */
1480
+ Clear = 13,
1481
+ /** Dirty snow, ice, sand */
1482
+ Rough = 14,
1483
+ Cliff = 15
1484
+ }
1485
+
1486
+ export declare enum TheaterType {
1487
+ None = 0,
1488
+ Temperate = 1,
1489
+ Urban = 2,
1490
+ Snow = 4,
1491
+ Lunar = 8,
1492
+ Desert = 16,
1493
+ NewUrban = 32,
1494
+ All = 63
1495
+ }
1496
+
1497
+ export declare class ThreatRules {
1498
+ myEffectivenessCoefficientDefault: number;
1499
+ targetEffectivenessCoefficientDefault: number;
1500
+ targetSpecialThreatCoefficientDefault: number;
1501
+ targetStrengthCoefficientDefault: number;
1502
+ targetDistanceCoefficientDefault: number;
1503
+ readIni(ini: IniSection): this;
1504
+ }
1505
+
1506
+ export declare interface Tile extends IsoTile {
1507
+ /**
1508
+ * Raw terrain type, as found in the mapfile.
1509
+ * This is altered by placed map objects and results in the landType property
1510
+ */
1511
+ terrainType: TerrainType;
1512
+ landType: LandType;
1513
+ /** If this tile has a bridge, it will have a different land type on the bridge */
1514
+ onBridgeLandType: LandType | undefined;
1515
+ rampType: number;
1516
+ /** This is needed for generating passability graph nodes */
1517
+ id: string;
1518
+ /** Duplicates tile occlusion state for data locality */
1519
+ occluded: boolean;
1520
+ }
1521
+
1522
+ export declare interface TileResourceData {
1523
+ tile: Tile;
1524
+ /** Number of gem bails */
1525
+ gems: number;
1526
+ /** Number of ore bails */
1527
+ ore: number;
1528
+ /** Is this a mining drill? (tiberium tree) */
1529
+ spawnsOre: boolean;
1530
+ }
1531
+
1532
+ export declare interface UnitData extends GameObjectData {
1533
+ rules: TechnoRules;
1534
+ owner: string;
1535
+ /** Distance in tiles at which the unit can see. Used for revealing shroud and auto-attack. */
1536
+ sight: number;
1537
+ veteranLevel: VeteranLevel;
1538
+ guardMode: boolean;
1539
+ purchaseValue: number;
1540
+ primaryWeapon?: WeaponData;
1541
+ secondaryWeapon?: WeaponData;
1542
+ deathWeapon?: WeaponData;
1543
+ attackState?: AttackState;
1544
+ hitPoints: number;
1545
+ maxHitPoints: number;
1546
+ /** Facing angle in degrees (counter-clockwise, relative to world N / screen NE) */
1547
+ direction?: number;
1548
+ onBridge?: boolean;
1549
+ zone?: ZoneType;
1550
+ buildStatus?: BuildStatus;
1551
+ factory?: FactoryData;
1552
+ rallyPoint?: Tile;
1553
+ isPoweredOn?: boolean;
1554
+ garrisonUnitCount?: number;
1555
+ garrisonUnitsMax?: number;
1556
+ /** Facing angle of the turret in degrees, if applicable (counter-clockwise, relative to world N / screen NE) */
1557
+ turretFacing?: number;
1558
+ /** Which turret is currently being used, if applicable (for IFV) */
1559
+ turretNo?: number;
1560
+ isIdle?: boolean;
1561
+ /** If the unit is not currently incapacitated and is able to move */
1562
+ canMove?: boolean;
1563
+ /** The current velocity vector in world space */
1564
+ velocity?: THREE.Vector3;
1565
+ /** Only applicable to infantry */
1566
+ stance?: StanceType;
1567
+ /** Only applicable to harvesters */
1568
+ harvestedOre?: number;
1569
+ /** Only applicable to harvesters */
1570
+ harvestedGems?: number;
1571
+ /** Only applicable to aircraft */
1572
+ ammo?: number;
1573
+ /** If the unit is under the effect of a chrono/temporal weapon */
1574
+ isWarpedOut: boolean;
1575
+ /** The ID of the unit currently mind controlling us, if applicable */
1576
+ mindControlledBy?: number;
1577
+ /** The number of ticks remaining until dynamite attached to this unit explodes (from Crazy Ivan) */
1578
+ tntTimer?: number;
1579
+ }
1580
+
1581
+ export declare class V3RocketRules extends MissileRules {
1582
+ readIni(ini: IniSection): this;
1583
+ }
1584
+
1585
+ export declare enum VeteranAbility {
1586
+ FASTER = 0,
1587
+ STRONGER = 1,
1588
+ FIREPOWER = 2,
1589
+ SCATTER = 3,
1590
+ ROF = 4,
1591
+ SIGHT = 5,
1592
+ SELF_HEAL = 6
1593
+ }
1594
+
1595
+ export declare enum VeteranLevel {
1596
+ None = 0,
1597
+ Veteran = 1,
1598
+ Elite = 2
1599
+ }
1600
+
1601
+ export declare class VeteranRules {
1602
+ /** must destroy this multiple of self-value to become a veteran [per level] */
1603
+ veteranRatio: number;
1604
+ /** multiplier to damage */
1605
+ veteranCombat: number;
1606
+ /** multiplier to max speed */
1607
+ veteranSpeed: number;
1608
+ /** multiplier to sight */
1609
+ veteranSight: number;
1610
+ /** For armor, think of it as max strength being multiplied by the number (in reality, damage is divided by this */
1611
+ veteranArmor: number;
1612
+ /** ROF delay multiplier */
1613
+ veteranROF: number;
1614
+ /** maximum veteran level that can be obtained */
1615
+ veteranCap: number;
1616
+ /** Do initial forces start as veterans? */
1617
+ initialVeteran: boolean;
1618
+ readIni(ini: IniSection): this;
1619
+ }
1620
+
1621
+ export declare enum VhpScan {
1622
+ None = 0,
1623
+ Normal = 1,
1624
+ Strong = 2
1625
+ }
1626
+
1627
+ export declare class WarheadRules {
1628
+ private rules;
1629
+ animList: string[];
1630
+ bombDisarm: boolean;
1631
+ bullets: boolean;
1632
+ cellSpread: number;
1633
+ /** This flag determines whether this warhead sinks and causes a water splash anim */
1634
+ conventional: boolean;
1635
+ culling: boolean;
1636
+ electricAssault: boolean;
1637
+ emEffect: boolean;
1638
+ infDeath: InfDeathType;
1639
+ ivanBomb: boolean;
1640
+ makesDisguise: boolean;
1641
+ mindControl: boolean;
1642
+ nukeMaker: boolean;
1643
+ paralyzes: number;
1644
+ parasite: boolean;
1645
+ percentAtMax: number;
1646
+ proneDamage: number;
1647
+ psychicDamage: boolean;
1648
+ radiation: boolean;
1649
+ rocker: boolean;
1650
+ sonic: boolean;
1651
+ temporal: boolean;
1652
+ /** Damage multiplier per armor type */
1653
+ verses: Map<ArmorType, number>;
1654
+ wallAbsoluteDestroyer: boolean;
1655
+ wall: boolean;
1656
+ wood: boolean;
1657
+ constructor(rules: IniSection);
1658
+ get name(): string;
1659
+ private parse;
1660
+ }
1661
+
1662
+ export declare interface WeaponData {
1663
+ type: WeaponType;
1664
+ rules: WeaponRules;
1665
+ projectileRules: ProjectileRules;
1666
+ warheadRules: WarheadRules;
1667
+ /** Minimum distance in tiles at which weapon can be fired */
1668
+ minRange: number;
1669
+ /** Maximum distance in tiles at which weapon can be fired */
1670
+ maxRange: number;
1671
+ /** Speed of the weapon's projectile in leptons/tick */
1672
+ speed: number;
1673
+ /** If the weapon just fired and is currently on cooldown, how many ticks remaining before it can fire again */
1674
+ cooldownTicks: number;
1675
+ }
1676
+
1677
+ /** Data structure for a rules.ini weapon section */
1678
+ export declare class WeaponRules {
1679
+ private rules;
1680
+ ambientDamage: number;
1681
+ anim: string[];
1682
+ areaFire: boolean;
1683
+ burst: number;
1684
+ cellRangefinding: boolean;
1685
+ damage: number;
1686
+ decloakToFire: boolean;
1687
+ fireOnce: boolean;
1688
+ isAlternateColor: boolean;
1689
+ isElectricBolt: boolean;
1690
+ isHouseColor: boolean;
1691
+ isLaser: boolean;
1692
+ isRadBeam: boolean;
1693
+ isSonic: boolean;
1694
+ laserDuration: number;
1695
+ limboLaunch: boolean;
1696
+ minimumRange: number;
1697
+ name: string;
1698
+ neverUse: boolean;
1699
+ omniFire: boolean;
1700
+ projectile: string;
1701
+ radLevel: number;
1702
+ range: number;
1703
+ report: string[];
1704
+ revealOnFire: boolean;
1705
+ rof: number;
1706
+ sabotageCursor: boolean;
1707
+ spawner: boolean;
1708
+ /** Speed in leptons/tick */
1709
+ speed: number;
1710
+ /** Original INI speed value */
1711
+ iniSpeed: number;
1712
+ suicide: boolean;
1713
+ useSparkParticles: boolean;
1714
+ warhead: string;
1715
+ constructor(rules: IniSection);
1716
+ private parse;
1717
+ }
1718
+
1719
+ export declare enum WeaponType {
1720
+ Primary = 0,
1721
+ Secondary = 1,
1722
+ DeathWeapon = 2
1723
+ }
1724
+
1725
+ export declare enum ZoneType {
1726
+ /** Unit is on the ground */
1727
+ Ground = 0,
1728
+ /** Unit is in the air */
1729
+ Air = 1,
1730
+ /** Unit is in the water */
1731
+ Water = 2
1732
+ }
1733
+
1734
+ export { }