ViewUnits beta
Interface of @v12-engine/client
export interface ViewUnits<U extends string = string>The game's units as its view draws them (GameView.units): the looks of each type, the HUD over every unit, the ring under one picked, the outline of one pointed at, its ink, blood, death and building, and the models' baking, materials and sharing
Members
baked
baked?: boolean | {
near?: number;
most?: number;
};How unit types whose look says nothing of baked (UnitLook.baked) are drawn: as copies of one mesh, their animations baked, past so many cells of the camera (near, 25 when left out; true is the same), a skeleton of their own nearer where they are in view or a few cells from it (out of view, a unit up close is a copy too, and takes its skeleton before it comes into view); false draws every such type with its own skeleton, as before. A type's own baked has the last word. The editor's Set up as a unit writes a type's into looks.json.
most caps how many units have a skeleton of their own for being up close, the nearest the camera: past it, units in view up close are copies too, whose clips step at the bake's 30 frames a second (left out, no cap). For a game that zooms in on hundreds of units at once
blood
blood?: BloodLook;How units bleed when the player has blood on (client.blood). A unit type says otherwise with UnitLook.blood
bloodFor
bloodFor?: (entity: EntityView, event: BloodEvent) => BloodLook | null | undefined;How a hit or a death bleeds, for any entity, decided in code before its type has a say: a look, null for none, nothing to leave it to the type. Every hit is asked, magic too, once the game has this
buffMarker
buffMarker?: BuffMarkerLook;What shows over a unit with a buff of a colour that no style draws, as data (BuffMarkerLook): none where nothing is said; {} the ready-made glow (presetView lays it in)
burning
burning?: ViewBurning;How things burn, in a game with the burning pack (ViewBurning): the look of every type that says nothing of its own (UnitLook.burning), and how many effects and lights may play at once. The client's fire when left out
constructionFor
constructionFor?: (entity: EntityView) => UnitLook['construction'] | undefined;How any building goes up, decided in code before its type has a say (UnitLook.construction): every building of a race rising from dust, by entity.owner's race. Nothing leaves it to the type
deathFor
deathFor?: (entity: EntityView, death: DeathEvent) => DeathLook | undefined;How anything of the game dies, decided in code before its type has a say (DeathLook): one look for every building that burns down, a death of the game's own for a how. Nothing leaves it to the type (UnitLook.death, onDeath)
hover
hover?: HoverLook | ((entity: EntityView) => HoverLook | false | undefined);The outline of what the pointer is over, unit or building, drawn around its silhouette on the screen (HoverLook: its colour, its width in pixels): one look for all, or decided for each entity (false or nothing for none). None when left out; client.hoverOutline turns it off for a player
hud
hud?: ViewUnitHud;The HUD over every unit: its plates, their defaults, the bars, or a system of the game's own (ViewUnitHud)
ink
ink?: InkLook;How units are inked when the player has ink on (client.inking): a dark line around each model. A unit type says otherwise, or decides in code, with UnitLook.ink
items
items?: ViewItemLooks;How the items lying on the ground look: by item id, and decided in code (ViewItemLooks)
looks
looks: UnitLooks<U>;Models of the unit types, and how they are drawn
materials
materials?: ModelMaterials;How models' materials are drawn: standard, lit as the client's own shapes are (what every model of the example's is made for), or pbr, as their makers made them (metal, roughness, normal maps), with light from around them (a default environment, made in the page, where the scene has none). By model as well (ModelDef.materials). standard when left out. A model whose file the map brought (taken in in the editor) is pbr unless it says
merge
merge?: boolean;Whether the copies of models with a skeleton of their own (units up close, portraits, cinematics' props) have their parts that move with one skeleton and are painted alike merged into one mesh, where the model does not say (ModelDef.merge, which has the last word): one draw a unit rather than one a part, in the view and every shadow pass. true when left out; false keeps every part a mesh of its own by its name, for a game whose code hides or recolours parts of a unit. The copies of a baked crowd are one mesh either way
rallyFlag
rallyFlag?: RallyFlagLook;A selected building's rally point, as data (RallyFlagLook: a model, a colour, a size): none where nothing is said; {} the ready-made pole and cloth (presetView lays it in). A type's own over it (UnitLook.rallyFlag)
ring
ring?: (entity: EntityView) => RingLook | undefined;The ring under a selected entity, decided for each: its colour, its size, none
select
select?: OutlineLook | ((entity: EntityView) => OutlineLook | false | undefined);The outline of what is selected (OutlineLook: a line around its silhouette on the screen, or a glow; its colour, width, pulse, whether it is seen through walls), beside or in the place of the ring under it: one look for all, or decided for each entity (false or nothing for none). None when left out. kit.outline draws one on anything in code
target
target?: OutlineLook | ((entity: EntityView, ability: string) => OutlineLook | false | undefined);The outline of what the pointer is over while an ability is aimed (PlayerController.mode of kind ability), in the place of hover: a glow on what the spell could be cast on. One look for all, or decided for the entity and the ability (false or nothing for none: hover shows then). Left out, hover shows while aiming as at any other time