PlayersArea beta
Class of @v12-engine/editor
export declare class PlayersAreaThe map's players: who plays, where they start, their races, teams, resources and computer players
Members
constructor
constructor(
doc: MapDocument);Constructs a new instance of the PlayersArea class
addPlayer
addPlayer(): MapPlayer | null;Adds the next player to the map, up to the game's most; gives it back, or null when the map is full
doc
readonly doc: MapDocument;The map document the area works on
maxPlayers
get maxPlayers(): number;Players the game allows on its maps (Rules.maxPlayers): 8 when it says nothing
movePlayer
movePlayer(from: number, to: number): void;Moves a player to another seat (master plan OC2): the seats keep their numbers (ids), and a player moved takes all of theirs along (name, team, colour, start, what they start with, their objects). Not the neutral and creeps, nor the game's own players. What names a seat by number (a script, the game's data) keeps naming that seat
movePlayerAi
movePlayerAi(id: PlayerId, list: 'order' | 'waves', from: number, to: number, race?: string): void;Moves an item of a computer player's build order or waves to another place among them: one step to undo
player
player(id: PlayerId): MapPlayer | undefined;The player with that id, or undefined when the map has none
removePlayer
removePlayer(id: PlayerId): void;Takes a player off the map, and everything of theirs with them
setPlayerAi
setPlayerAi(id: PlayerId, change: Partial<MapAi>): void;How a computer player of the map plays (master plan OC4, MapPlayer.data.ai, read by world.computers.seat): its difficulty, personality and settings (AiSettings). What is given as undefined is taken away; one step to undo
setPlayerAiPart
setPlayerAiPart(id: PlayerId, part: MapAiPart, value: AiFlags | readonly unknown[] | undefined, race?: string): void;A part of a computer player's settings (MapAiPart: its flags, its build order, its waves), taken away where empty: of its settings for every race, or of those for one race it may play (MapAi.races). One step to undo
setPlayerCamera
setPlayerCamera(id: PlayerId, camera: string | undefined): void;Where a player's view starts, by the name of a camera of the map, or over their start with none
setPlayerSetup
setPlayerSetup(id: PlayerId, change: Partial<Pick<MapPlayer, 'controller' | 'race' | 'resources' | 'data'>>): void;Who plays a player, the race they play, what they start with, and the game's own fields of them: also for the players the game decides, whose names and teams are its own. What is given as undefined goes back to the game's
setStart
setStart(id: PlayerId, point: Vec2 | undefined): void;Sets the player's start location to a point, or takes it away with undefined
updatePlayer
updatePlayer(id: PlayerId, change: Partial<Pick<MapPlayer, 'name' | 'team' | 'color'>>): void;Changes the name, team or colour of a player. Not of the game's own players: who they are is the game's