Skip to content

ClientKit beta ​

Interface of @v12-engine/client

ts
export interface ClientKit

The kit as the client's parts and a game's code read it (client.renderer.kit): the eases and timers, the state and the ground, the services by name, what the units' view does to an entity (its place, tint, clips, parts, bones), the looks, the light and the fog, a ring on the ground, the line around what the pointer is over, the effects

Members ​

afterClips ​

ts
afterClips: LiteUnitsService['afterClips'];

Turns an entity's bones after its clips each frame, the game's own way, until what it gives back is called

bleed ​

ts
bleed(at: {
        x: number;
        z: number;
    }, look: Record<string, unknown>, from?: {
        x: number;
        z: number;
    }): void;

Blood at a place, thrown away from another, where a game's renderer gives the blood's service

breakApart ​

ts
breakApart: LiteUnitsService['breakApart'];

Breaks something into pieces of what it is made of at a place: whether it did

clipsOf ​

ts
clipsOf: LiteUnitsService['clipsOf'];

The clips an entity's model has, by name

daylight ​

ts
daylight(): number;

How light it is now, from 0 at night to 1 at noon

drawn ​

ts
drawn: LiteUnitsService['drawn'];

Where an entity is drawn now, and whether it shows

eases ​

ts
readonly eases: EaseRegistry;

The eases by name, the game's among the client's

flash ​

ts
flash(id: number, color: readonly [number, number, number], seconds?: number): void;

An entity in a colour for so many seconds (a hit): by hand, as the feel's flash

fx ​

ts
readonly fx: FxView;

The effects: played by name or def, the game's by name, their stats

hide ​

ts
hide: LiteUnitsService['hide'];

An entity not drawn, or drawn again

hover ​

ts
hover(id: number | undefined, look: OutlineLook | undefined): void;

The line around what the pointer is over, or none

inking ​

ts
readonly inking: boolean;

Whether the line round every model is drawn

letGo ​

ts
letGo: LiteUnitsService['letGo'];

Takes away the model of a death the game kept

looks ​

ts
readonly looks: Record<string, unknown>;

The units' looks as the renderer draws them, by type

marksOf ​

ts
marksOf: LiteUnitsService['marksOf'];

Seconds from now to each mark still to come in what an entity plays once

onMark ​

ts
onMark(id: number, listener: (mark: string, clip: string) => void): () => void;

The marks of an entity's clips as they are reached, until what it gives back is called

optional ​

ts
optional<T>(service: Service<T>): T | undefined;

A service by its name, or none where it is not given

partsOf ​

ts
partsOf(id: number): string[];

The parts of an entity's model by their names, where it is kept in parts: none where merged

playClip ​

ts
playClip: LiteUnitsService['playClip'];

Plays a clip of an entity's model by its name, over what the units' view plays: whether it has the clip

point ​

ts
point: LiteUnitsService['point'];

A place on an entity's model by its name (ModelDef.points), where it is drawn now

provide ​

ts
provide<T>(service: Service<T>, made: T): void;

Gives a service by its name, for the renderers that ask for it

releaseClip ​

ts
releaseClip: LiteUnitsService['releaseClip'];

Lets the units' view choose an entity's clip again

require ​

ts
require<T>(service: Service<T>): T;

A service by its name: one that is not given throws

ring ​

ts
ring(x: number, z: number, color: readonly [number, number, number], from: number, to: number): void;

A ring on the ground that grows from one size to another and goes

sees ​

ts
sees(x: number, z: number): boolean;

Whether the player sees a place of the map now, under the fog of war

setAlpha ​

ts
setAlpha: LiteUnitsService['setAlpha'];

How much of an entity shows, from 0 to 1

setInking ​

ts
setInking(on: boolean): void;

Draws the line round every model, or stops

setMaterial ​

ts
setMaterial(id: number, name: string, def: MaterialDef | null): void;

A material of an entity's model by its name drawn with another look, or its own again (null)

setPart ​

ts
setPart(id: number, name: string, say: Parameters<NonNullable<LiteUnitsService['setPart']>>[2]): boolean;

A part of an entity's model shown, hidden or tinted, by its name: whether it has one

shake ​

ts
shake(x: number, z: number, strength: number): void;

The view shaken as by something heavy at a spot: strength about 1 for a big blast

sound ​

ts
sound(name: string, at?: {
        x: number;
        z: number;
    }, volume?: number): void;

Plays a sound by its name, at a place of the map or everywhere

state ​

ts
readonly state: GameState;

What the player sees of the game, as the last snapshots said it

stopClip ​

ts
stopClip: LiteUnitsService['stopClip'];

Stops a clip played by hand at once: whether one played

swing ​

ts
swing: LiteUnitsService['swing'];

Seconds an entity's attack clip takes to the blow, where its model marks it

terrain ​

ts
readonly terrain: Terrain;

The map's ground: its heights, its cells

timers ​

ts
readonly timers: ViewTimers;

Waits and repeats on the view's clock, ended with the client

tint ​

ts
tint: LiteUnitsService['tint'];

An entity drawn in a colour over its own, or as it is again