@chronodivide/game-api 0.73.0 → 0.74.0-dev.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/dist/index.d.ts +63 -11
- package/dist/index.js +15 -1
- package/dist/res/ra2cd.mix +0 -0
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -102,10 +102,16 @@ export declare class Bot {
|
|
|
102
102
|
#private;
|
|
103
103
|
name: string;
|
|
104
104
|
country: string;
|
|
105
|
-
protected
|
|
106
|
-
protected
|
|
107
|
-
protected
|
|
108
|
-
|
|
105
|
+
protected context: BotContext;
|
|
106
|
+
protected get game(): GameApi;
|
|
107
|
+
protected get player(): PlayerApi;
|
|
108
|
+
/** @deprecated Use {@link Bot.game} instead */
|
|
109
|
+
protected get gameApi(): GameApi;
|
|
110
|
+
/** @deprecated Use {@link Bot.player} instead */
|
|
111
|
+
protected get actionsApi(): ActionsApi;
|
|
112
|
+
/** @deprecated Use {@link Bot.player} instead */
|
|
113
|
+
protected get productionApi(): ProductionApi;
|
|
114
|
+
protected get logger(): LoggerApi;
|
|
109
115
|
constructor(name: string, country: string);
|
|
110
116
|
/**
|
|
111
117
|
* Toggles bot debug mode, allowing the bot implementation to switch some debug features on or off.
|
|
@@ -115,11 +121,18 @@ export declare class Bot {
|
|
|
115
121
|
*/
|
|
116
122
|
setDebugMode(debugMode: boolean): this;
|
|
117
123
|
getDebugMode(): boolean;
|
|
124
|
+
onGameInit(gameApi: GameApi): void;
|
|
118
125
|
onGameStart(gameApi: GameApi): void;
|
|
119
126
|
onGameTick(gameApi: GameApi): void;
|
|
120
127
|
onGameEvent(ev: ApiEvent, gameApi: GameApi): void;
|
|
121
128
|
}
|
|
122
129
|
|
|
130
|
+
export declare class BotContext {
|
|
131
|
+
game: GameApi;
|
|
132
|
+
player: PlayerApi;
|
|
133
|
+
logger: LoggerApi;
|
|
134
|
+
}
|
|
135
|
+
|
|
123
136
|
export declare class Box2 extends THREE.Box2 {
|
|
124
137
|
}
|
|
125
138
|
|
|
@@ -271,6 +284,8 @@ export declare class CrewRules {
|
|
|
271
284
|
sovietCrew: string;
|
|
272
285
|
sovietSurvivorDivisor: number;
|
|
273
286
|
survivorRate: number;
|
|
287
|
+
thirdCrew: string;
|
|
288
|
+
thirdSurvivorDivisor: number;
|
|
274
289
|
readIni(ini: IniSection): this;
|
|
275
290
|
}
|
|
276
291
|
|
|
@@ -320,8 +335,12 @@ export declare enum FactoryType {
|
|
|
320
335
|
|
|
321
336
|
export declare class GameApi {
|
|
322
337
|
#private;
|
|
323
|
-
|
|
324
|
-
|
|
338
|
+
map: MapApi;
|
|
339
|
+
rules: RulesApi;
|
|
340
|
+
/** @deprecated Use {@link GameApi.map} instead */
|
|
341
|
+
get mapApi(): MapApi;
|
|
342
|
+
/** @deprecated Use {@link GameApi.rules} instead */
|
|
343
|
+
get rulesApi(): RulesApi;
|
|
325
344
|
isPlayerDefeated(playerName: string): boolean;
|
|
326
345
|
areAlliedPlayers(p1Name: string, p2Name: string): boolean;
|
|
327
346
|
canPlaceBuilding(playerName: string, buildingName: string, tile: Tile): boolean;
|
|
@@ -503,6 +522,7 @@ export declare class GeneralRules {
|
|
|
503
522
|
spyMoneyStealPercent: number;
|
|
504
523
|
spyPowerBlackout: number;
|
|
505
524
|
technician: string;
|
|
525
|
+
thirdDisguise: string;
|
|
506
526
|
threat: ThreatRules;
|
|
507
527
|
treeStrength: number;
|
|
508
528
|
unitsUnsellable: boolean;
|
|
@@ -708,8 +728,13 @@ export declare class MapApi {
|
|
|
708
728
|
* This method has a big performance penalty and should be used with care.
|
|
709
729
|
*/
|
|
710
730
|
findPath(speedType: SpeedType, subCell: boolean, from: PathNode, to: PathNode, options?: PathFinderOptions): PathNode[];
|
|
711
|
-
/**
|
|
712
|
-
|
|
731
|
+
/**
|
|
732
|
+
* Used to determine connectivity between path nodes for the given SpeedType.
|
|
733
|
+
*
|
|
734
|
+
* Should only be used with ground, non-teleporting units.
|
|
735
|
+
* Preferred over {@link MapApi.findPath} when the full path is not needed. Complexity is O(1).
|
|
736
|
+
*/
|
|
737
|
+
getReachabilityMap(speedType: SpeedType, subCell: boolean): ReachabilityMap;
|
|
713
738
|
/** If the tile is not covered by shroud for the specified player */
|
|
714
739
|
isVisibleTile(tile: Tile, playerName: string, tileElevation?: number): boolean;
|
|
715
740
|
getTileResourceData(tile: Tile): TileResourceData | undefined;
|
|
@@ -929,6 +954,7 @@ export declare class ParadropRules {
|
|
|
929
954
|
/** In leptons */
|
|
930
955
|
paradropRadius: number;
|
|
931
956
|
sovParaDrop: ParadropSquad[];
|
|
957
|
+
yuriParaDrop: ParadropSquad[];
|
|
932
958
|
readIni(ini: IniSection): this;
|
|
933
959
|
private readParadropSquad;
|
|
934
960
|
getParadropSquads(sideType: SideType): ParadropSquad[];
|
|
@@ -963,6 +989,19 @@ export declare enum PipColor {
|
|
|
963
989
|
Blue = 4
|
|
964
990
|
}
|
|
965
991
|
|
|
992
|
+
export declare class PlayerApi {
|
|
993
|
+
#private;
|
|
994
|
+
name: string;
|
|
995
|
+
actions: ActionsApi;
|
|
996
|
+
production: ProductionApi;
|
|
997
|
+
getPlayerData(): PlayerData;
|
|
998
|
+
isDefeated(): boolean;
|
|
999
|
+
isAlliedWith(otherPlayerName: string): boolean;
|
|
1000
|
+
canPlaceBuilding(buildingName: string, tile: Tile): boolean;
|
|
1001
|
+
/** See {@link GameApi.getVisibleUnits} */
|
|
1002
|
+
getVisibleUnits(type: "self" | "allied" | "hostile" | "enemy", filter?: (r: TechnoRules) => boolean): number[];
|
|
1003
|
+
}
|
|
1004
|
+
|
|
966
1005
|
export declare interface PlayerData {
|
|
967
1006
|
name: string;
|
|
968
1007
|
country: Country | undefined;
|
|
@@ -1193,6 +1232,13 @@ export declare class RadiationRules {
|
|
|
1193
1232
|
readIni(ini: IniSection): void;
|
|
1194
1233
|
}
|
|
1195
1234
|
|
|
1235
|
+
export declare interface ReachabilityMap {
|
|
1236
|
+
/** Checks if two nodes are connected. */
|
|
1237
|
+
isReachable(from: PathNode, to: PathNode): boolean;
|
|
1238
|
+
/** A number representing the connected region. Undefined if impassable terrain. */
|
|
1239
|
+
getRegionId(node: PathNode): number | undefined;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1196
1242
|
export declare interface Rectangle {
|
|
1197
1243
|
x: number;
|
|
1198
1244
|
y: number;
|
|
@@ -1247,12 +1293,17 @@ export declare class RulesApi {
|
|
|
1247
1293
|
getIni(): IniFile;
|
|
1248
1294
|
}
|
|
1249
1295
|
|
|
1250
|
-
/**
|
|
1296
|
+
/**
|
|
1297
|
+
* Side/faction types (ally/soviet). Relic naming since tiberian sun.
|
|
1298
|
+
* Do not change the order. The numerical values are mapped to fields in rules.ini such as AIBasePlanningSide.
|
|
1299
|
+
*/
|
|
1251
1300
|
export declare enum SideType {
|
|
1252
1301
|
GDI = 0,
|
|
1253
1302
|
Nod = 1,
|
|
1254
|
-
|
|
1255
|
-
|
|
1303
|
+
/** Yuri */
|
|
1304
|
+
ThirdSide = 2,
|
|
1305
|
+
Civilian = 3,
|
|
1306
|
+
Mutant = 4
|
|
1256
1307
|
}
|
|
1257
1308
|
|
|
1258
1309
|
export declare interface Size {
|
|
@@ -1341,6 +1392,7 @@ export declare class TechnoRules extends ObjectRules {
|
|
|
1341
1392
|
private forbiddenHouses;
|
|
1342
1393
|
requiresStolenAlliedTech: boolean;
|
|
1343
1394
|
requiresStolenSovietTech: boolean;
|
|
1395
|
+
requiresStolenThirdTech: boolean;
|
|
1344
1396
|
cost: number;
|
|
1345
1397
|
points: number;
|
|
1346
1398
|
soylent: number;
|