Skip to content

UnitLook ​

Interface of @v12-engine/client

ts
export interface UnitLook

How one unit type looks on the screen: its model or shapes, effects, death, construction and more, as data or code

Members ​

altitude ​

ts
altitude?: number;

How high above the ground it is, for what flies

attackClip ​

ts
attackClip?: (entity: EntityView, target?: EntityView) => string | undefined;

The clip of an attack of its, by what it is at (target, when the player sees it): swings that take turns. The usual when nothing

attacks beta ​

ts
attacks?: readonly AttackLook[];

A look for each of its attacks, by place (UnitTypeDef.attacks): the clips it swings with (in turn or at random, never the same twice running), the clip of a critical strike, how fast they play, what it shoots, the effects as it shoots and where it strikes, the sounds, the streak behind a swing, and all of it otherwise while it carries a buff (AttackLook). What one leaves out is the unit's own (shot, its sounds); attackClip and shotFor decide over it in code

baked ​

ts
baked?: boolean | {
        near?: number;
        model?: ModelDef;
    };

Large armies (S41): its units drawn as copies of one mesh, their animations baked into a texture, where each has a skeleton of its own and is a draw of its own: hundreds cost what a handful does. Off when left out. A unit has its own skeleton all the same while something needs its parts (a clip the game plays on it, a colour laid over it, a line around it, a place on it, its pieces when it breaks), and within near of the camera while it is in view or a few cells from it, where it is seen up close (out of view, a copy too) (a level of the picker of detail, draw: 'baked', where no levels are said for it: near is its from); model is a simpler one to bake in the place of its own (with the same animations), for the copies. Copies snap from one animation to the next rather than blending, and draw no line of ink

blood ​

ts
blood?: boolean | BloodLook | ((entity: EntityView, event: BloodEvent) => BloodLook | boolean | null | undefined);

Its blood, where it is hit (by a weapon, or what deals physical damage) and where it dies: false for none (a machine, a skeleton), a look of its own even when blood is off for the game, or decided for every hit and death in code: green for a slime, more on a critical strike. As the game's blood is (GameView.units.blood, when the player has it on) when it gives nothing

burning beta ​

ts
burning?: BurningLook;

How it looks while it burns, in a game with the burning pack (BurningLook): the effect at points of its model, a sound as it catches, the colour it chars to, said again for another kind of burning (how: a blight, frost). The game's for every type (GameView.units.burning), then the client's fire, where it says nothing. How it comes down once burnt is its death for that kind (death.how.burnt)

castClip ​

ts
castClip?: (entity: EntityView, ability: string, level?: number) => string | undefined;

The clip of a cast of its, by the ability and its level. What casts says when nothing

casts beta ​

ts
casts?: Readonly<Record<string, CastLook>>;

How it casts each ability, by the ability's id (CastLook, the Model view's Attack tab): its clip, how fast, an effect on its hands, a sound, over the ability's own (AbilityLook.cast) field by field, for this unit alone

construction beta ​

ts
construction?: ConstructionLook;

How a building looks as it goes up (ConstructionLook: stages of models and of its own nodes, a birth clip scrubbed by progress, how it rises, what plays while builders work, when it is done or called off, an upgrade's look); one of the game's own in code is its pose, reading entity.construction. Growing up out of the ground (motion.construction) when left out. GameView.units.constructionFor for every type of a game

damaged beta ​

ts
damaged?: readonly DamagedStage[] | ((entity: EntityView, health: number) => readonly DamagedStage[] | undefined);

How it looks as it is hurt, by the share of its health left (DamagedStage): smoke from the roof under half, fire under a quarter, started and stopped as its health crosses each, both ways (a repaired building stops smoking). Or decided in code, again whenever its health changes: the stages on now

death beta ​

ts
death?: DeathLook;

How it dies (DeathLook, DeathDef): falls, breaks, burns, comes down, what is left of it. What shatter and debris say, or falling over, when left out. Decided per death in code with onDeath, and for the whole game with GameView.units.deathFor

debris ​

ts
debris?: DebrisPiece[];

What it breaks into when it dies, instead of falling over: pieces that fly away from what killed it and settle, with physics (see Debris), like a skeleton falling apart into bones. It falls over where there is no physics

detail ​

ts
detail?: DetailLevel[];

How its entities are drawn by their distance (DetailLevel), over everything said of its model (ModelDef.detail)

height ​

ts
height: number;

Where the health bar goes

illusion ​

ts
illusion?: [number, number, number] | false;

The colour laid over an illusion of it its side sees for what it is (tintFor first): pale blue when left out, false for none

ink ​

ts
ink?: boolean | InkLook | ((entity: EntityView) => InkLook | boolean | undefined);

Its ink: a line drawn around its model, as a cel-shaded game has. false for none, a look for one even when ink is off for the game, or decided in code whenever its state comes in: a hero's in gold, an enemy's in red, none for what hides. As the game's ink is (GameView.units.ink, when the player has it on) when it gives nothing

lights beta ​

ts
lights?: (entity: EntityView, declared: readonly ModelLightDef[]) => readonly ModelLightDef[] | undefined;

The lights a unit gives now, of those its model declares (ModelDef.lights), or others: a mage's staff only while it casts, a forge's mouth only while it works, a house's windows once it is built. Asked a few times a second; what it gives back is matched to what was lit, and lit again only when it differs. Its model's, when left out

looks ​

ts
looks?: Record<string, ModelDef>;

Other models it can be drawn with, by name, for things that come in kinds like trees. An entity is drawn with the one its look names, one without a look with one of mix, always the same for the same entity

loop ​

ts
loop?: (entity: EntityView, motion: {
        speed: number;
        walking: boolean;
    }) => string | undefined;

The clip it keeps playing, decided every frame from how it moves: a combat stance, a limp when badly hurt. The usual when nothing

mix ​

ts
mix?: string[];

The looks an entity without one of its own gets. All of them when left out

model ​

ts
model?: ModelDef;

Drawn instead of the shapes once it has loaded. Shapes that are only shown in a situation, like what a worker carries, are still drawn along with it

modelFor ​

ts
modelFor?: (entity: EntityView) => ModelDef | undefined;

The model it is drawn with, decided again whenever its state comes in: a buff's form, an elite skin, a skin a component names. What model, looks and mix say, when it gives nothing

motion ​

ts
motion?: MotionLook;

How it moves besides its clips, where the client moves it (MotionLook): today's when left out

onDeath ​

ts
onDeath?: (entity: EntityView, death: DeathEvent) => DeathLook | undefined;

How it dies, decided for each death, from who killed it, with what and how (death): exploding only when a cannon killed it, a death clip of its own for a critical strike. Its fields go over death's; nothing leaves it to death

onHit beta ​

ts
onHit?: HitLook | ((entity: EntityView, hit: HitEvent) => HitLook | undefined);

How it reacts when hit (HitLook): an effect where it is struck, a flash, a shake, a sound. Or decided for each hit in code, from the hit (how much, of what, by whom): sparks off armour only from a weapon

onMark ​

ts
onMark?: (entity: EntityView, mark: {
        name: string;
        clip: string;
    }) => boolean | void;

A mark of a clip it plays is reached (ClipDef.marks, set in Model Setup): its name and the clip. The client does what the name says (hit sounds the blow, foot the footstep, fx:<effect> and sound:<sound> play those of the game's); returning true says the game did it, and the client does not. Marks of other names are the game's alone

portrait ​

ts
portrait?: PortraitLook;

Its portrait in a box (the HUD's faces, a speaker's): a model of its own or its own, framed on its head and shoulders from its bounds, playing its idle and its talk as a speaker; each field over that (PortraitLook). looks.json's portrait is laid over it field by field

pose ​

ts
pose?: (entity: EntityView, place: Placement, frame: {
        dt: number;
        time: number;
    }) => void;

Placed by the game's code, every frame, after the client has placed it (where it stands, turned, as big as it is): a wobble, a lean into a turn, a building rising out of the ground its own way

rallyFlag beta ​

ts
rallyFlag?: RallyFlagLook | false;

A building's own rally flag, as data (RallyFlagLook: a model, a colour, a size), over the view's (GameView.units.rallyFlag); false none for it (RV64). What the Model view's Rally flag tab writes

shapes ​

ts
shapes: ShapeDef[];

The solids it is drawn from when it has no model, or while one loads

shatter ​

ts
shatter?: number;

Breaks its own model into about this many pieces when it dies, which fly away from what killed it and settle: a building coming down. With debris, both. It falls over where there is no physics

shot ​

ts
shot?: ShotDef;

What it shoots, when that is not the usual

shotFor ​

ts
shotFor?: (projectile: ProjectileView, shooter?: EntityView) => ShotDef | undefined;

What a shot of its looks like, decided for every shot: a flaming arrow on a critical strike, by the rules' look. shot when nothing

tintFor ​

ts
tintFor?: (entity: EntityView) => [number, number, number] | undefined;

A colour laid over it, decided again whenever its state comes in: frozen blue, a boss's purple. Nothing for none

unitHud beta ​

ts
unitHud?: UnitHudSource;

The HUD over it (see UnitHudDef): a plate (UnitHudPlate: widgets as data) or plates with rules around them, or a function deciding it every frame, null for none. Over the game's (GameView.units.hud.def) and the client's; client.unitHud.defs changes it while the game runs

vary ​

ts
vary?: {
        scale?: number;
        lean?: number;
    };

Makes every one of them look a little different, for things that stand in numbers like trees. scale is how much bigger or smaller they get (0.2: up to a fifth), lean how far they tip, in radians

worked ​

ts
worked?: 'sway' | 'none' | ((entity: EntityView) => void);

What a resource does as it is worked (a worker's blow, the chop event): sways, as a tree does (sway, when left out), nothing (none), or what the game does in code: a mine that rumbles, a crystal that flashes