ClientKit beta
Interface of @v12-engine/client
export interface ClientKitThe 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
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
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
breakApart: LiteUnitsService['breakApart'];Breaks something into pieces of what it is made of at a place: whether it did
clipsOf
clipsOf: LiteUnitsService['clipsOf'];The clips an entity's model has, by name
daylight
daylight(): number;How light it is now, from 0 at night to 1 at noon
drawn
drawn: LiteUnitsService['drawn'];Where an entity is drawn now, and whether it shows
eases
readonly eases: EaseRegistry;The eases by name, the game's among the client's
flash
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
readonly fx: FxView;The effects: played by name or def, the game's by name, their stats
hide
hide: LiteUnitsService['hide'];An entity not drawn, or drawn again
hover
hover(id: number | undefined, look: OutlineLook | undefined): void;The line around what the pointer is over, or none
inking
readonly inking: boolean;Whether the line round every model is drawn
letGo
letGo: LiteUnitsService['letGo'];Takes away the model of a death the game kept
looks
readonly looks: Record<string, unknown>;The units' looks as the renderer draws them, by type
marksOf
marksOf: LiteUnitsService['marksOf'];Seconds from now to each mark still to come in what an entity plays once
onMark
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
optional<T>(service: Service<T>): T | undefined;A service by its name, or none where it is not given
partsOf
partsOf(id: number): string[];The parts of an entity's model by their names, where it is kept in parts: none where merged
playClip
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
point: LiteUnitsService['point'];A place on an entity's model by its name (ModelDef.points), where it is drawn now
provide
provide<T>(service: Service<T>, made: T): void;Gives a service by its name, for the renderers that ask for it
releaseClip
releaseClip: LiteUnitsService['releaseClip'];Lets the units' view choose an entity's clip again
require
require<T>(service: Service<T>): T;A service by its name: one that is not given throws
ring
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
sees(x: number, z: number): boolean;Whether the player sees a place of the map now, under the fog of war
setAlpha
setAlpha: LiteUnitsService['setAlpha'];How much of an entity shows, from 0 to 1
setInking
setInking(on: boolean): void;Draws the line round every model, or stops
setMaterial
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
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
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
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
readonly state: GameState;What the player sees of the game, as the last snapshots said it
stopClip
stopClip: LiteUnitsService['stopClip'];Stops a clip played by hand at once: whether one played
swing
swing: LiteUnitsService['swing'];Seconds an entity's attack clip takes to the blow, where its model marks it
terrain
readonly terrain: Terrain;The map's ground: its heights, its cells
timers
readonly timers: ViewTimers;Waits and repeats on the view's clock, ended with the client
tint
tint: LiteUnitsService['tint'];An entity drawn in a colour over its own, or as it is again