@chronodivide/game-api 0.65.0 → 0.67.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ # 0.67.0
4
+
5
+ - Update game engine version to 0.72
6
+ - Allow observers when creating games in online mode
7
+ - Add `CreateOnlineOpts.nonInteractive` option when creating games in online mode
8
+ - Add `CreateOnlineOpts.onGameStart` callback when creating games in online mode
9
+
10
+ # 0.66.0
11
+
12
+ - Update game engine version to 0.71
13
+
3
14
  # 0.65.0
4
15
 
5
16
  - Update game engine version to 0.70
package/dist/index.d.ts CHANGED
@@ -50,8 +50,8 @@ export declare class ActionsApi {
50
50
 
51
51
  export declare interface Agent {
52
52
  name: string;
53
- /** Country name as found in rules.ini [Countries] */
54
- country: string;
53
+ /** Country name as found in rules.ini [Countries]. Omit for observers. */
54
+ country?: string;
55
55
  }
56
56
 
57
57
  export declare class AiRules {
@@ -250,6 +250,14 @@ export declare interface CreateOnlineOpts extends CreateBaseOpts {
250
250
  clientUrl: string;
251
251
  botPassword: string;
252
252
  agents: [Bot, ...Agent[]];
253
+ /** If specified, process will not wait for player input before creating the game. */
254
+ nonInteractive?: boolean;
255
+ /**
256
+ * Called when the game is created.
257
+ *
258
+ * @param joinUrls - The URLs that each player agent can use to join the game.
259
+ */
260
+ onGameCreate?(joinUrls: Map<Agent, string>): unknown;
253
261
  }
254
262
 
255
263
  export declare type CreateOpts = CreateOfflineOpts | CreateOnlineOpts;
@@ -377,7 +385,11 @@ export declare class GameInstanceApi {
377
385
  getCurrentTick(): number;
378
386
  getTickRate(): number;
379
387
  getPlayerStats(): PlayerStats[];
380
- saveReplay(targetDir?: string): void;
388
+ /**
389
+ * @param targetDir - Where to save the replay file.
390
+ * @returns - The path where the replay file was saved to.
391
+ */
392
+ saveReplay(targetDir?: string): string;
381
393
  dispose(): void;
382
394
  }
383
395
 
@@ -521,23 +533,24 @@ export declare enum InfDeathType {
521
533
  export declare class IniFile {
522
534
  private sections;
523
535
  fromString(data: string): this;
524
- fromJson(data: Record<string, unknown>): void;
536
+ fromJson(data: Record<string, unknown>): this;
525
537
  toString(): string;
526
538
  clone(): IniFile;
527
539
  getOrCreateSection(name: string): IniSection;
528
540
  getSection(name: string): IniSection | undefined;
529
541
  getOrderedSections(): IniSection[];
530
- private isValueArray;
531
542
  mergeWith(ini: IniFile): this;
532
543
  }
533
544
 
534
545
  export declare class IniSection {
535
546
  name: string;
536
- entries: Map<string, string>;
547
+ entries: Map<string, string | string[]>;
548
+ private sections;
537
549
  constructor(name: string);
550
+ fromJson(data: Record<string, unknown>): this;
538
551
  clone(): IniSection;
539
- set(name: string, value: string): void;
540
- get(name: string): string | undefined;
552
+ set(name: string, value: string | string[]): void;
553
+ get(name: string): string | string[] | undefined;
541
554
  has(name: string): boolean;
542
555
  getString(name: string, defaultValue?: string): string;
543
556
  getNumber(key: string, defaultValue?: number): number;
@@ -556,6 +569,7 @@ export declare class IniSection {
556
569
  /** Emulates fixed-point precision given a floating-point number */
557
570
  private toFixedPointPrecision;
558
571
  getBool(key: string, defaultValue?: boolean): boolean;
572
+ getKeyArray(key: string, defaultValue?: string[]): string[];
559
573
  getArray(key: string, sep?: RegExp, defaultValue?: string[]): string[];
560
574
  getNumberArray(key: string, sep?: RegExp, defaultValue?: number[]): number[];
561
575
  getFixedArray(key: string, sep?: RegExp, defaultValue?: number[]): number[];
@@ -563,8 +577,13 @@ export declare class IniSection {
563
577
  getEnumNumeric<T>(key: string, enumType: any, defaultValue: T): T;
564
578
  getEnumArray<T>(key: string, enumType: any, sep?: RegExp, defaultValue?: T[], caseInsensitive?: boolean): T[];
565
579
  getHighestNumericIndex(): number;
580
+ isNumericIndexArray(): boolean;
566
581
  getConcatenatedValues(): string;
567
- toString(): string;
582
+ toString(namePrefix?: string): string;
583
+ mergeWith(other: IniSection): void;
584
+ getOrCreateSection(name: string): IniSection;
585
+ getSection(name: string): IniSection | undefined;
586
+ getOrderedSections(): IniSection[];
568
587
  }
569
588
 
570
589
  export declare interface IsoTile {