Skip to content

PlayerState beta ​

Interface of @v12-engine/engine

ts
export interface PlayerState

A player as the screen is told of them: name, team, colour, resources and their standing to the player it is for

Members ​

color ​

ts
color: [number, number, number];

The player's colour as RGB, each 0..1

creeps ​

ts
creeps?: boolean;

Whether they are the creeps: hostile to everyone, but no one's rival

defeated ​

ts
defeated: boolean;

Whether the player is out of the game

id ​

ts
id: PlayerId;

The player's id

name ​

ts
name: string;

The name shown for the player

neutral ​

ts
neutral: boolean;

Whether the player is a neutral one, owner of mines and the like

own ​

ts
own?: {
        resources: Record<ResourceId, number>;
        supplyUsed: number;
        supplyCap: number;
        supplies?: Record<string, {
            used: number;
            cap: number;
        }>;
        upkeep: {
            tier: number;
            name: string;
            income: number;
        };
        upgrades: Record<string, number>;
        researching: string[];
        tech: string[];
        heroes: HeroSummary[];
        objectives: ObjectiveState[];
        timers?: ShownTimer[];
        unlocks?: Record<string, Message | null>;
        availability?: Record<string, boolean>;
    };

Only filled in for the player the snapshot is for

race ​

ts
race?: string;

The race they play (raceOf): left out in a game without races

relation ​

ts
relation: 'self' | 'ally' | 'enemy' | 'neutral';

What they are to the player the snapshot is for: by their teams, or as the rules set it (setRelation)

shared ​

ts
shared?: {
        control: boolean;
        vision: boolean;
    };

What the player the snapshot is for shares with this ally (shareWith): their units' control, and their team's sight (always, for an ally of their team). Left out for who is not an ally

team ​

ts
team: number;

The player's team number; players on one team are allies