@scm-js/plugin-api 1.21.0 → 1.23.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 +79 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1051,6 +1051,12 @@ export interface Toast {
|
|
|
1051
1051
|
* default colour, so a string written before the remaster can render differently now —
|
|
1052
1052
|
* `bleedingLines` finds exactly that case, and the Repair plugin turns it into a finding
|
|
1053
1053
|
* offering to write the reset the old game supplied for free.
|
|
1054
|
+
*
|
|
1055
|
+
* `runsOf` is a modern renderer in the other way too: it takes one alignment for a whole
|
|
1056
|
+
* line, where 1.16.1 obeyed every alignment code on it and stacked the pieces between
|
|
1057
|
+
* them in one place. `stackedLines` finds the lines that were drawn that way and
|
|
1058
|
+
* `flattenStacks` lays them out left to right — the one rewrite here that loses something
|
|
1059
|
+
* (where each piece sat), which is why the Repair plugin offers it unticked.
|
|
1054
1060
|
*/
|
|
1055
1061
|
/** What a control byte does. Colours carry an `rgb`; the rest are layout or visibility. */
|
|
1056
1062
|
export type CodeEffect = "color" | "mimic" | "invisible" | "align" | "clip" | "nothing" | "space";
|
|
@@ -1095,6 +1101,23 @@ export interface BleedingLine {
|
|
|
1095
1101
|
/** The code Remastered carries onto it — the whole entry, so a caller can name it. */
|
|
1096
1102
|
carried: TextCode;
|
|
1097
1103
|
}
|
|
1104
|
+
/**
|
|
1105
|
+
* A line the game draws in more than one place at once. 0x12 and 0x13 move the text that
|
|
1106
|
+
* follows them to the right or the centre of the line they are on, and 1.16.1 honoured
|
|
1107
|
+
* every one of them: `Name<12>by Author` drew `Name` at the left and `by Author` at the
|
|
1108
|
+
* right of the same line. Lobby names, unit names and briefings were built out of that —
|
|
1109
|
+
* the "stacked" text a classic map shows and a renderer that takes one alignment for the
|
|
1110
|
+
* whole line does not.
|
|
1111
|
+
*
|
|
1112
|
+
* `runsOf` is one of those renderers: `TextLine.align` holds a single alignment, the last
|
|
1113
|
+
* one the line set, so every piece before it lands somewhere its author did not choose.
|
|
1114
|
+
*/
|
|
1115
|
+
export interface StackedLine {
|
|
1116
|
+
/** 0-based index of the line within the string. */
|
|
1117
|
+
line: number;
|
|
1118
|
+
/** How many pieces of text the line draws, each at its own alignment. */
|
|
1119
|
+
pieces: number;
|
|
1120
|
+
}
|
|
1098
1121
|
/** Every built-in dialog, by the id `openDialogAtom` takes; `DialogHost` maps each to its component. */
|
|
1099
1122
|
export type DialogId = "newMap" | "openMap" | "saveAs" | "exportImage" | "mapProperties" | "resizeMap" | "mapRevision" | "playerSettings" | "forceSettings" | "playerColors" | "unitSettings" | "upgradeSettings" | "techSettings" | "stringEditor" | "soundEditor" | "switches" | "locationList" | "unitProperties" | "locationProperties" | "spriteProperties" | "triggerEditor" | "missionBriefing" | "cuwpEditor" | "replaceTerrain" | "autoStarts" | "testMap" | "symmetry" | "gridSettings" | "preferences" | "shortcuts" | "validateMap" | "statistics" | "importTriggers" | "exportTriggers" | "importStrings" | "exportStrings" | "find" | "about" | "confirmClose" | "plugins" | "confirmPlugin" | "pluginDialog" | "gameData" | "update";
|
|
1100
1123
|
export interface MapImageOptions {
|
|
@@ -2781,6 +2804,36 @@ export interface TriggersApi {
|
|
|
2781
2804
|
};
|
|
2782
2805
|
/** A trigger's `Comment` action text, when it has one. */
|
|
2783
2806
|
comment(trigger: TriggerRecord): string | null;
|
|
2807
|
+
/**
|
|
2808
|
+
* EUD: the player value that reaches a memory address through the deaths table
|
|
2809
|
+
* (`(address − consts.triggers.deathsTable) / 4`, the address rounded down to a dword)
|
|
2810
|
+
* — what a Deaths condition or Set Deaths action stores in `player` with `unitId` 0 to
|
|
2811
|
+
* read or write that dword.
|
|
2812
|
+
*/
|
|
2813
|
+
epd(address: number): number;
|
|
2814
|
+
/** EUD: the address a record's `player` and `unitId` reach through the deaths table — `epd`'s inverse, and a plain death counter's cell as an address. */
|
|
2815
|
+
addressOf(player: number, unitId?: number): number;
|
|
2816
|
+
/**
|
|
2817
|
+
* A content fingerprint of a trigger: the same wherever it sits in the list and
|
|
2818
|
+
* whatever the game's bookkeeping bits say. What a plugin that generates triggers
|
|
2819
|
+
* finds its run by (`TriggerClaimSpec.locate`), and what an editor keeps a selection
|
|
2820
|
+
* by across a list that changed under it.
|
|
2821
|
+
*/
|
|
2822
|
+
fingerprint(trigger: TriggerRecord): string;
|
|
2823
|
+
/**
|
|
2824
|
+
* Every death-counter cell (`[player, unit]`) and switch the triggers read or write —
|
|
2825
|
+
* TRIG when `list` is omitted. A player group counts as every slot it can resolve to
|
|
2826
|
+
* (`Current Player` as the trigger's owners); a class unit (*Any unit*, *Men*, …)
|
|
2827
|
+
* counts for nothing, and an EUD player is an address, not a cell. What a plugin that
|
|
2828
|
+
* allocates counters or switches of its own must keep clear of.
|
|
2829
|
+
*/
|
|
2830
|
+
usage(list?: TriggerRecord[]): {
|
|
2831
|
+
cells: [
|
|
2832
|
+
player: number,
|
|
2833
|
+
unit: number
|
|
2834
|
+
][];
|
|
2835
|
+
switches: number[];
|
|
2836
|
+
};
|
|
2784
2837
|
/**
|
|
2785
2838
|
* Tell the editor that a run of the trigger list is generated by this plugin. The
|
|
2786
2839
|
* Trigger Editor badges those rows, locks them and offers the plugin's own editor in
|
|
@@ -3359,9 +3412,16 @@ export interface TriggerConsts {
|
|
|
3359
3412
|
readonly triggerFlags: typeof TriggerFlag;
|
|
3360
3413
|
/**
|
|
3361
3414
|
* The address of the game's death table, which is the base an EUD player value is
|
|
3362
|
-
* counted from: `epd = (address - deathsTable) / 4
|
|
3415
|
+
* counted from: `epd = (address - deathsTable) / 4` (`triggers.epd` does the sum).
|
|
3363
3416
|
*/
|
|
3364
3417
|
readonly deathsTable: number;
|
|
3418
|
+
/**
|
|
3419
|
+
* The value of a condition's or action's trailing `mask` word that makes it a *masked*
|
|
3420
|
+
* record: the game then reads or writes only the bits set in the record's `location`
|
|
3421
|
+
* field, which is how one byte, one word or one bit of a dword is reached. StarCraft:
|
|
3422
|
+
* Remastered only; 1.16.1 ignores the word.
|
|
3423
|
+
*/
|
|
3424
|
+
readonly maskedRecord: 17235;
|
|
3365
3425
|
}
|
|
3366
3426
|
export interface ActiveBrush {
|
|
3367
3427
|
mode: TerrainMode;
|
|
@@ -3684,6 +3744,11 @@ export interface NamesApi {
|
|
|
3684
3744
|
* remaster can draw in colours its author never chose — `bleedingLines` finds exactly
|
|
3685
3745
|
* those lines and `fixBleeding` writes the reset the old game supplied. Pass
|
|
3686
3746
|
* `resetPerLine` to `runs` to see the old rendering.
|
|
3747
|
+
*
|
|
3748
|
+
* The other thing the old game did and a modern renderer does not is honour every
|
|
3749
|
+
* alignment code on a line, stacking the pieces between them in one place: `stackedLines`
|
|
3750
|
+
* finds those lines and `flattenStacks` lays them out left to right. `runs` is one of the
|
|
3751
|
+
* renderers that cannot show them — `TextLine.align` is one alignment for the whole line.
|
|
3687
3752
|
*/
|
|
3688
3753
|
export interface TextApi {
|
|
3689
3754
|
/** Every byte the game gives a meaning, in order; `rgb` is set for the colours only. */
|
|
@@ -3710,6 +3775,19 @@ export interface TextApi {
|
|
|
3710
3775
|
* games draw it alike. Idempotent, and never changes what the string says.
|
|
3711
3776
|
*/
|
|
3712
3777
|
fixBleeding(text: string): string;
|
|
3778
|
+
/**
|
|
3779
|
+
* The lines of `text` that 1.16.1 drew at more than one alignment at once — the
|
|
3780
|
+
* "stacked" lobby and unit names a classic map is built with. A line whose only
|
|
3781
|
+
* alignment code sits at its head is not one: that code places the line.
|
|
3782
|
+
*/
|
|
3783
|
+
stackedLines(text: string): StackedLine[];
|
|
3784
|
+
/**
|
|
3785
|
+
* `text` with every stacked line laid out left to right: the alignment codes that split
|
|
3786
|
+
* it dropped and its pieces joined in writing order, a space between two that would
|
|
3787
|
+
* otherwise run together. Colours and every other byte survive, so nothing the string
|
|
3788
|
+
* says is lost — only where each piece sat. Idempotent.
|
|
3789
|
+
*/
|
|
3790
|
+
flattenStacks(text: string): string;
|
|
3713
3791
|
}
|
|
3714
3792
|
export type DialogSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
3715
3793
|
export interface DialogButton {
|