Skip to content

PlayerActions beta ​

Interface of @v12-engine/client

ts
export interface PlayerActions

What 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 ​

ts
activateSubgroup(id: number): void;

Makes the units of a type, among what is selected, the ones the command card is for

assignGroup ​

ts
assignGroup(number: number): void;

Control groups: what is selected kept under a number, selected again (added with add), forgotten, moved

buy ​

ts
buy(item: string): void;

Buys an item of the shop that is open, and sells one of the hero's by its slot

cancelTraining ​

ts
cancelTraining(building: number, index: number): void;

Takes a unit out of a building's queue by its place in it

chat ​

ts
chat(text: string, to?: 'allies' | 'all'): void;

Says a line of chat: to the player's side, or to everyone

deleteGroup ​

ts
deleteGroup(number: number): void;

Forgets the control group with this number

formation ​

ts
readonly formation: string | undefined;

The formation the player's orders to a point take, by id: the rules' when undefined

give ​

ts
give(to: PlayerId, resource: string, amount: number): void;

Gives an ally some of a resource the player has

hover ​

ts
hover(id: string | undefined): void;

Tells the HUD which command button the pointer is over, or none

hovered ​

ts
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 ​

ts
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 ​

ts
moveGroup(from: number, to: number): void;

Moves a control group from one number to another

ping ​

ts
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 ​

ts
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 ​

ts
readonly quickCast: boolean;

Quick cast: a key casts at the pointer at once, without a click to say where

recallGroup ​

ts
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 ​

ts
select(ids: number[], options?: {
        add?: boolean;
    }): void;

Selects these entities, or adds them to what is selected

selectHero ​

ts
selectHero(index: number): boolean;

Selects the player's hero by its place among theirs. False when there is none there

selectIdleWorker ​

ts
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 ​

ts
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 ​

ts
sell(item: number): void;

Sells the hero's item in this slot

setFormation ​

ts
setFormation(id: string | undefined): void;

Sets the formation the player's orders take, by id; undefined for the rules'

setQuickCast ​

ts
setQuickCast(on: boolean): void;

Turns quick cast on or off

setSelectionLocked ​

ts
setSelectionLocked(on: boolean): void;

Locks or unlocks the selection against clicks and boxes

share ​

ts
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 ​

ts
startDrop(item: number): void;

Picks up the item in this slot to drop or hand over

toggleAutocast ​

ts
toggleAutocast(buttonId: string): void;

Turns a button's casting by itself on or off

toggleShop ​

ts
toggleShop(): boolean;

Opens the shop the selection is at, or closes it: false where there is none

undoBuy ​

ts
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 ​

ts
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