MapEditor beta
Class of @v12-engine/editor
export declare class MapEditor extends MapDocumentEverything the map editor does to a map, apart from showing it. Keeps the terrain in line with the layers, checks where things may go, and remembers what came before for undo.
Every change is an operation of the history (see MapHistory), with a name. Each method that changes the map is one on its own; run makes one of several, and begin with commit or cancel one of what happens over time, like a drag
It is a document (MapDocument: the map, its terrain, its history, the ids of what is made) with its areas, a plain class each made with the document and the areas it needs: the ground (editor.ground), objects and camps (editor.objects), cameras, regions, points, paths and doodads (editor.markers), things of the game's own kinds (editor.things), names and the game's fields (editor.names), the players (editor.players), what the map says of itself (editor.info), its look (editor.look), many things at once (editor.batch), prefabs (editor.prefabs) and the brushes (editor.brushes)
Made by the editor for its map (editor.doc), and without a screen too, for a script or a test: new MapEditor(map, registry)
Members
constructor
constructor(map: GameMap, registry: Registry, terrain?: Terrain, options?: MapEditorOptions);Constructs a new instance of the MapEditor class
Parameters
terrain: one of the same size to reuse, so that whatever draws it can stay
addArea
addArea(def: MapAreaDef): () => void;Adds an area of the game's own (MapAreaDef), made now with this editor. One of the same id is an error. Gives back what takes it away
area
area<K extends string>(id: K): MapAreaOf<K>;An area of the game's own, by its id, typed as MapEditorAreas says. One there is none of is an error, said by its id
batch
readonly batch: BatchArea;Many things at once, of any kind: the map's symmetry, copy and paste, lining up, moving markers together
brushes
readonly brushes: BrushesArea;The brushes: a stroke raises the land, cuts cliffs, lays water and paint, scatters and erases
ground
readonly ground: GroundArea;The ground as a whole: the map's size, the bounds of play, heightmaps, new land
hasArea
hasArea(id: string): boolean;Whether there is an area of the game's own of an id
info
readonly info: InfoArea;What the map says of itself and the game says of it: its name, forces, random groups, item tables, data, problems
look
readonly look: LookArea;How the map looks and sounds: its environment, grounds, sounds, lights, effects, decals, wind, clouds, weather, mist, day
markers
readonly markers: MarkersArea;What the rules know by name or the map is dressed with: cameras, regions, points, paths and doodads
names
readonly names: NamesArea;What things are called, one name each across the map, and the game's own fields on them
objects
readonly objects: ObjectsArea;What stands on the map: objects and camps, where they may go, whose they are, and what they start as
players
readonly players: PlayersArea;The map's players: who plays, where they start, their races, teams, resources and computer players
prefabs
readonly prefabs: PrefabsArea;Prefabs on the map: instances placed, read off their parts, brought to a new version, reverted, applied, unpacked
removeArea
removeArea(id: string): void;Takes an area of the game's own away, by its id: nothing for one there is none of
terrainRules
readonly terrainRules: TerrainRulesArea;The tiles painted by height and slope: bands told once, or kept live as the ground is shaped
things
readonly things: ThingsArea;Things of kinds of the game's own, kept in the map's data under the kind's name
writerOf
writerOf(kind: CollectionId): CollectionWriter;How the things of a kind are written (CollectionWriter): by the area that has them, a copy given a name of its own where the copied one's is taken