@scm-js/plugin-api 1.11.0 → 1.12.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 +28 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1639,6 +1639,13 @@ export interface DoodadPlacementOptions {
|
|
|
1639
1639
|
/** Keep the left column on an even tile, as StarEdit always does. */
|
|
1640
1640
|
snapToGrid: boolean;
|
|
1641
1641
|
}
|
|
1642
|
+
export interface DoodadVerdict {
|
|
1643
|
+
ok: boolean;
|
|
1644
|
+
/** The footprint leaves the map (never allowed). */
|
|
1645
|
+
outOfBounds: boolean;
|
|
1646
|
+
/** Cell indices (row-major) whose ground fails the check, for the ghost to mark red. */
|
|
1647
|
+
bad: number[];
|
|
1648
|
+
}
|
|
1642
1649
|
export type StartLayout = "ring" | "corners";
|
|
1643
1650
|
export interface StartPlacementResult {
|
|
1644
1651
|
changes: UnitChange[];
|
|
@@ -2733,6 +2740,14 @@ export interface QueryApi {
|
|
|
2733
2740
|
startLocations(): StartLocation[];
|
|
2734
2741
|
/** Whether a unit type may be placed centred there, and what stops it; null with no map. */
|
|
2735
2742
|
placement(unitId: number, x: number, y: number): PlacementVerdict | null;
|
|
2743
|
+
/**
|
|
2744
|
+
* StarEdit's ground check for a doodad with its top-left tile at (tx, ty): `ok`, or the
|
|
2745
|
+
* cells (row-major) whose ground is not what `DoodadInfo.required` asks for. It reads the
|
|
2746
|
+
* map as it is right now — inside a `document.edit` that is the map with the transaction's
|
|
2747
|
+
* earlier changes in — so a plugin can paint a cliff and then look for where a ramp fits.
|
|
2748
|
+
* Null with no map or without the tileset graphics.
|
|
2749
|
+
*/
|
|
2750
|
+
doodadPlacement(doodadId: number, tx: number, ty: number): DoodadVerdict | null;
|
|
2736
2751
|
/** The MASK bits at a tile: bit n set = player n + 1 starts fogged there (every bit when the map has no MASK). */
|
|
2737
2752
|
fogAt(tx: number, ty: number): number;
|
|
2738
2753
|
/** The string table as it stands (index 0 is nothing); empty with no map. */
|
|
@@ -3385,6 +3400,19 @@ export interface DoodadInfo {
|
|
|
3385
3400
|
/** Footprint in tiles. */
|
|
3386
3401
|
width: number;
|
|
3387
3402
|
height: number;
|
|
3403
|
+
/**
|
|
3404
|
+
* A ramp: a doodad with the VF4 ramp bit, filed under a cliff category with no name of
|
|
3405
|
+
* its own. Ramps fit only on the cliff shape they were drawn for (see `required`), and
|
|
3406
|
+
* a tileset has them for a few terrain pairs only.
|
|
3407
|
+
*/
|
|
3408
|
+
ramp: boolean;
|
|
3409
|
+
/**
|
|
3410
|
+
* Per cell (row-major, `width` × `height`): the CV5 tile group that must already lie
|
|
3411
|
+
* under it for StarEdit to allow the placement, or 0 for "anything". A flat terrain's
|
|
3412
|
+
* pair is its `TerrainType.group` (even) and `group + 1`; the other numbers are cliff
|
|
3413
|
+
* and shore pieces. `query.doodadPlacement` applies the rule.
|
|
3414
|
+
*/
|
|
3415
|
+
required: number[];
|
|
3388
3416
|
}
|
|
3389
3417
|
export interface PaletteApi {
|
|
3390
3418
|
active(): PaletteChoice;
|