PlayerActions beta
Interface of @v12-engine/client
export interface PlayerActionsWhat a HUD does on the player's behalf: what a click on one of its buttons does. The player's hands (client.controller), as far as a HUD goes
Members
activateSubgroup
activateSubgroup(id: number): void;Makes the units of a type, among what is selected, the ones the command card is for
assignGroup
assignGroup(number: number): void;Control groups: what is selected kept under a number, selected again (added with add), forgotten, moved
buy
buy(item: string): void;Buys an item of the shop that is open, and sells one of the hero's by its slot
cancelTraining
cancelTraining(building: number, index: number): void;Takes a unit out of a building's queue by its place in it
chat
chat(text: string, to?: 'allies' | 'all'): void;Says a line of chat: to the player's side, or to everyone
deleteGroup
deleteGroup(number: number): void;Forgets the control group with this number
formation
readonly formation: string | undefined;The formation the player's orders to a point take, by id: the rules' when undefined
give
give(to: PlayerId, resource: string, amount: number): void;Gives an ally some of a resource the player has
hover
hover(id: string | undefined): void;Tells the HUD which command button the pointer is over, or none
hovered
readonly hovered: string | undefined;The id of the button the pointer is over, for what the screen shows of it (its range on the ground): hover(id) as it comes over one, hover(undefined) as it leaves
learn
learn(ability: string | number): boolean;Learns a hero's ability, by its id or its place among the hero's: false where it cannot be learned now
moveGroup
moveGroup(from: number, to: number): void;Moves a control group from one number to another
ping
ping(point: Vec2, kind?: PlayerPingKind, to?: 'allies' | 'all'): void;Pings a spot of the map for the player's allies (or everyone): the minimap's button pings where the view looks
press
press(id: string, queue?: boolean): boolean;Presses a button of the command card by its id, as a click does; queued after what is under way with queue
quickCast
readonly quickCast: boolean;Quick cast: a key casts at the pointer at once, without a click to say where
recallGroup
recallGroup(number: number, add?: boolean): boolean;Selects the control group with this number, adding to the selection with add; false when it is empty
select
select(ids: number[], options?: {
add?: boolean;
}): void;Selects these entities, or adds them to what is selected
selectHero
selectHero(index: number): boolean;Selects the player's hero by its place among theirs. False when there is none there
selectIdleWorker
selectIdleWorker(all?: boolean): boolean;Selects a worker with nothing to do, the next each time; all of them with all. False when there is none
selectionLocked
readonly selectionLocked: boolean;Whether clicks and boxes on the map leave the selection as it is: set from code, or by the player's key
sell
sell(item: number): void;Sells the hero's item in this slot
setFormation
setFormation(id: string | undefined): void;Sets the formation the player's orders take, by id; undefined for the rules'
setQuickCast
setQuickCast(on: boolean): void;Turns quick cast on or off
setSelectionLocked
setSelectionLocked(on: boolean): void;Locks or unlocks the selection against clicks and boxes
share
share(ally: PlayerId, what: {
control?: boolean;
vision?: boolean;
}): void;Shares control of the player's units, or their team's sight, with an ally, or no longer
startDrop
startDrop(item: number): void;Picks up the item in this slot to drop or hand over
toggleAutocast
toggleAutocast(buttonId: string): void;Turns a button's casting by itself on or off
toggleShop
toggleShop(): boolean;Opens the shop the selection is at, or closes it: false where there is none
undoBuy
undoBuy(purchase?: number): void;Takes the latest purchase of the hero the shop is open for back, or the one named (ShopInfo.undo, ShopSettings.undo)
useItem
useItem(item: number, queue?: boolean): void;Uses an item of the hero's by its slot, and picks one up to drop or hand over