scmJS docs

api.palette

PaletteApi

The palettes' current picks — the terrain brush, the unit, sprite and doodad, the fog mode — and the placement options a plugin that places things should honour.

Members

active

active(): PaletteChoice;

setActive

setActive(choice: Partial<PaletteChoice>): void;

playerColor

playerColor(owner: number): string;

The colour a player's units are shown in, #rrggbb (the same as graphics.playerColor).

placementOptions

placementOptions(): PlacementOptions;

The Units palette's placement checks and snapping — what placeUnit, canPlaceUnit and query.placement apply, and whether an edit removes stranded units.

setPlacementOptions

setPlacementOptions(patch: Partial<PlacementOptions>): void;

doodadPlacement

doodadPlacement(): DoodadPlacementOptions;

The Doodads palette's rules: place anywhere, snap to grid.

setDoodadPlacement

setDoodadPlacement(patch: Partial<DoodadPlacementOptions>): void;

locationSnap

locationSnap(): number;

The Locations layer's snap step in pixels, 0 for off.

setLocationSnap

setLocationSnap(step: 0 | 8 | 16 | 32 | 64): void;

unitGroups

unitGroups(): UnitGroup[];

Every unit type, grouped the way the Units palette lists them.

unitName

unitName(unitId: number): string;

unitSize

unitSize(unitId: number): UnitSize;

spriteGroups

spriteGroups(): SpriteGroup[];

What the Sprites palette lists, by group; empty until the unit tables are loaded.

spriteName

spriteName(kind: SpriteKind, id: number): string;

"Terran Marine" for a unit sprite, the unit or GRP the pure sprite draws otherwise.

doodadCategories

doodadCategories(): { name: string; doodads: DoodadInfo[]; }[];

The open map's doodads by palette category; empty without the tileset graphics.

doodadInfo

doodadInfo(doodadId: number): DoodadInfo | null;

Types

Declarations only this group names.

RaceKeytype

type RaceKey = "terran" | "zerg" | "protoss" | "neutral";

Unit type catalogue: StarEdit names by units.dat id, and the palette's grouping of them.

UnitGroupinterface

interface UnitGroup
race: RaceKey
label: string
units: number[]

units.dat ids, in palette order.

SpriteGroupinterface

interface SpriteGroup
label: string
ids: number[]

PlacementOptionsinterface

interface PlacementOptions
checkCollision: boolean

Refuse to put a unit on top of another (ground units and buildings only).

checkTerrain: boolean

Refuse unwalkable ground for units and unbuildable tiles for buildings.

removeStranded: boolean

After a terrain edit, remove units the new terrain can no longer hold (the Terrain palette's toggle).

snapToGrid: boolean

Buildings snap their placement box to the tile grid (StarEdit always does; SCMDraft lets you turn it off).

DoodadPlacementOptionsinterface

interface DoodadPlacementOptions
placeAnywhere: boolean

Skip StarEdit's ground check: any doodad goes on any terrain, even over another doodad.

snapToGrid: boolean

Keep the left column on an even tile, as StarEdit always does.

PaletteChoiceinterface

interface PaletteChoice

What the Units, Sprites, Doodads and Fog of War palettes have picked — the thing a click on the map would place or paint. (The Terrain palette's pick is terrain.active().) Players are 0-based: owner 0 is Player 1.

fogViewPlayer: number

The player whose fog the Fog of War layer draws, 0-based.

unit: number

units.dat id the Units palette places.

owner: number

The player it places for, 0–11.

spriteKind: SpriteKind
sprite: number

sprites.dat id, placed when spriteKind is "pure".

unitSprite: number

units.dat id, placed when spriteKind is "unit" (doors and traps).

spriteFlipped: boolean
spriteDisabled: boolean
doodad: number

The Doodads palette's doodad id, or -1 before one was picked.

fogPlayers: number

Bit mask of the players the fog brush paints for (bit n = player n + 1).

fogMode: FogMode

UnitSizeinterface

interface UnitSize

A unit type's footprint, from units.dat; a one-tile box without the tables.

width: number

The placement box, in pixels.

height: number
building: boolean
flyer: boolean

DoodadInfointerface

interface DoodadInfo
id: number
name: string

"Trees #12" — the palette category and the id, which is the only name a doodad has.

category: string
width: number

Footprint in tiles.

height: number

Seen in

scmJS 0.1.0 · Generated from the repository. StarCraft and Brood War are trademarks of Blizzard Entertainment; this project ships none of their data.