@scm-js/plugin-api 1.72.0 → 1.73.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/index.d.ts +62 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4356,6 +4356,25 @@ export interface GameDataProfile {
|
|
|
4356
4356
|
* editor never fetches it.
|
|
4357
4357
|
*/
|
|
4358
4358
|
url?: string;
|
|
4359
|
+
/**
|
|
4360
|
+
* The races the data set adds to the game's own, when they are declared (no game file says
|
|
4361
|
+
* what a mod's races are called). Kept with the id: a profile handed to `attach` or
|
|
4362
|
+
* `install` with races keeps them, and one without gets those kept before for the same id —
|
|
4363
|
+
* after a new release of the mod (a new hash) as well. `setRaces` changes them. Absent in an
|
|
4364
|
+
* editor from before races a data set adds (`api.gameData.source()?.profile.races ?? []`).
|
|
4365
|
+
*/
|
|
4366
|
+
races?: DataSetRace[];
|
|
4367
|
+
}
|
|
4368
|
+
/** A race a data set adds to the game's own. */
|
|
4369
|
+
export interface DataSetRace {
|
|
4370
|
+
/** The race byte: 8–255. (0–7 are the game's and cannot be declared.) */
|
|
4371
|
+
id: number;
|
|
4372
|
+
/** What it is called, 40 characters at most, trimmed, not empty. */
|
|
4373
|
+
name: string;
|
|
4374
|
+
/** The lower-case letter its per-race files go by (`game\<letter>console.pcx`, `rez\statbtn<letter>.bin`), when it has them. */
|
|
4375
|
+
letter?: string;
|
|
4376
|
+
/** The game's race it plays as, where only the game's three are known: 0, 1 or 2. Absent: not declared. */
|
|
4377
|
+
like?: 0 | 1 | 2;
|
|
4359
4378
|
}
|
|
4360
4379
|
/** Where the session's game data comes from. */
|
|
4361
4380
|
export interface GameDataSource {
|
|
@@ -4550,6 +4569,41 @@ export interface GameDataApi {
|
|
|
4550
4569
|
* api.gameData.rehash(await modHashOfTheFiles());
|
|
4551
4570
|
*/
|
|
4552
4571
|
rehash(hash: string | null): GameDataSource | null;
|
|
4572
|
+
/**
|
|
4573
|
+
* The races the data set in use adds; empty for the game's own or when none is declared.
|
|
4574
|
+
* Absent in an editor from before races a data set adds: call it as
|
|
4575
|
+
* `api.gameData.races?.() ?? []`.
|
|
4576
|
+
*/
|
|
4577
|
+
races(): DataSetRace[];
|
|
4578
|
+
/**
|
|
4579
|
+
* Declare the races a data set adds, replacing its table: the data set in use by default,
|
|
4580
|
+
* or the profile `id`. Kept with the profile's id (it survives a new release of the mod and
|
|
4581
|
+
* a re-attach). Rows are normalized: sorted by id, a row with an id outside 8–255, an id an
|
|
4582
|
+
* earlier row has, or no name (or one over 40 characters) dropped; an empty list forgets
|
|
4583
|
+
* them. The game's own data set (and a Remastered installation's) takes none: returns null.
|
|
4584
|
+
* For the set in use, returns its source with the races, and fires what a change of the
|
|
4585
|
+
* data set fires (the `"gameData"` event), so open panels repaint; for another set, keeps
|
|
4586
|
+
* them for when it is used and returns null.
|
|
4587
|
+
*
|
|
4588
|
+
* @example
|
|
4589
|
+
* api.gameData.setRaces?.([{ id: 9, name: "Hivemind Remnant", letter: "h", like: 0 }]);
|
|
4590
|
+
* api.names.race(9); // "Hivemind Remnant"
|
|
4591
|
+
*/
|
|
4592
|
+
setRaces(races: readonly DataSetRace[], id?: string): GameDataSource | null;
|
|
4593
|
+
/**
|
|
4594
|
+
* What the data set in use suggests about races it adds, for a person naming them: `names`,
|
|
4595
|
+
* the strings its `rez\network.tbl` has past the game's own table, and `letters`, the
|
|
4596
|
+
* letters other than z, t, p and n with a `game\<letter>console.pcx` or
|
|
4597
|
+
* `rez\statbtn<letter>.bin` of its own. Names and letters already declared are left out;
|
|
4598
|
+
* empty for the game's own data set. These are hints a person confirms, never names to fill
|
|
4599
|
+
* in. A set in memory (`attach`) is asked through its function; a stored copy keeps none of
|
|
4600
|
+
* these files, so it gives none. Absent in an editor from before it
|
|
4601
|
+
* (`api.gameData.raceCandidates?.()`).
|
|
4602
|
+
*/
|
|
4603
|
+
raceCandidates(): Promise<{
|
|
4604
|
+
names: string[];
|
|
4605
|
+
letters: string[];
|
|
4606
|
+
}>;
|
|
4553
4607
|
}
|
|
4554
4608
|
/**
|
|
4555
4609
|
* The constants a plugin needs to *write* a record rather than read one: the bit masks in
|
|
@@ -5080,8 +5134,12 @@ export interface NamesApi {
|
|
|
5080
5134
|
/** An OWNR / IOWN controller byte: `Human`, `Computer`, `Neutral`, … */
|
|
5081
5135
|
playerType(value: number): string;
|
|
5082
5136
|
playerTypes(): NamedValue[];
|
|
5083
|
-
/**
|
|
5137
|
+
/**
|
|
5138
|
+
* A SIDE race byte: the game's eight by name, a race the data set in use declares
|
|
5139
|
+
* (`gameData.races()`) by its name, any other `Race {n}`.
|
|
5140
|
+
*/
|
|
5084
5141
|
race(value: number): string;
|
|
5142
|
+
/** The game's eight races in StarEdit's order, then the races the data set in use declares, by id. */
|
|
5085
5143
|
races(): NamedValue[];
|
|
5086
5144
|
/** One of the 27 trigger player groups (`Player 1` … `Non Allied Victory Players`). */
|
|
5087
5145
|
playerGroup(value: number): string;
|
|
@@ -5730,12 +5788,14 @@ export interface TestMapFile {
|
|
|
5730
5788
|
* The data set the map is being made with, when it is not the game's own: its id and
|
|
5731
5789
|
* name as `gameData.profile()` gives them, and the digest of its files (empty when none
|
|
5732
5790
|
* is known). A target that plays the map should play it with those files — the site's
|
|
5733
|
-
* play page is handed it as `dataSet` in its `scmjs.play` message.
|
|
5791
|
+
* play page is handed it as `dataSet` in its `scmjs.play` message. `races` when the data
|
|
5792
|
+
* set declares the races it adds (`gameData.races()`), so the target can name them.
|
|
5734
5793
|
*/
|
|
5735
5794
|
dataSet?: {
|
|
5736
5795
|
id: string;
|
|
5737
5796
|
name: string;
|
|
5738
5797
|
hash: string;
|
|
5798
|
+
races?: DataSetRace[];
|
|
5739
5799
|
};
|
|
5740
5800
|
}
|
|
5741
5801
|
/** What a preferences page's `mount` is handed. */
|