Skip to content

PlayerPings beta ​

Class of @v12-engine/client

ts
export declare class PlayerPings

The player's pings, in code (client.pings, indicators-plan P1): the defs of the kinds there are (GameView.pings.kinds), changed while the game plays, and a ping sent as the player with each kind's audience and cooldown

Members ​

constructor ​

ts
constructor(host: PlayerPingsHost, defs?: readonly PingDef[]);

Constructs a new instance of the PlayerPings class

canSend ​

ts
canSend(id: string): boolean;

Whether the player may send a kind now: one there is, the rules let go, off its cooldown

cooldownLeft ​

ts
cooldownLeft(id: string): number;

Seconds before the player may send a kind again (its cooldown): 0 when they may now

def ​

ts
def(id: string): PingDef | undefined;

A kind's def, by its id

define ​

ts
define(def: PingDef): void;

Adds a kind, or puts a def in place of the kind's of the same id

defs ​

ts
get defs(): readonly PingDef[];

Every kind there is, in the wheel's order

heard ​

ts
heard(ping: ShownPing): void;

A ping shown: told to what hears them (onPing). The client's, as it shows one

onChange ​

ts
onChange(listener: () => void): () => void;

Told when the kinds change (define, remove): what draws them, the wheel. Gives back the way to stop

onPing ​

ts
onPing(listener: (ping: ShownPing) => void): () => void;

Told of every ping shown on this screen (the player's, an ally's, or anyone's sent to all), with its def, who sent it and its colour: a game's own sound, a tutorial's step, a record. Gives back the way to stop

quick ​

ts
quick(point: Vec2): boolean;

The quick ping (the ping action, the minimap's): the first kind there is, to its audience; the engine's first kind where the game has none

remove ​

ts
remove(id: string): void;

Takes a kind away: not sent, not on the wheel, not drawn

send ​

ts
send(id: string, point: Vec2, to?: 'allies' | 'all'): boolean;

Sends a ping of a kind at a spot as the player, to its audience (PingDef.audience) unless to says otherwise. False where it is not sent: a kind there is not, one the rules do not let go, one on its cooldown