Skip to content

five-on-it / apps/client/src/renderer/cracks / Cracks

Class: Cracks ​

Defined in: apps/client/src/renderer/cracks.ts:139

The cracks of the cars on screen.

Constructors ​

Constructor ​

new Cracks(scene, models): Cracks

Defined in: apps/client/src/renderer/cracks.ts:155

Cracks drawn with the actor models' glass, in scene; their mesh and its shader are made now, so the first crack in a firefight costs no compile.

Parameters ​

scene ​

Scene

models ​

ActorModels

Returns ​

Cracks

Properties ​

made ​

made: number = 0

Defined in: apps/client/src/renderer/cracks.ts:149

Cracks left on any car so far, for the tests.

Methods ​

clear() ​

clear(): void

Defined in: apps/client/src/renderer/cracks.ts:206

Every car's glass clean again (the level was reset).

Returns ​

void


draw() ​

draw(eid, world, doors?): void

Defined in: apps/client/src/renderer/cracks.ts:346

Draws the cracks of the car eid this frame, its world matrix world and its doorways ajar doors (a crack on a door swings with it). Call it for every car in view, then flush.

Parameters ​

eid ​

number

world ​

Matrix

doors? ​

ReadonlyMap<string, number>

Returns ​

void


flush() ​

flush(): number

Defined in: apps/client/src/renderer/cracks.ts:363

Hands this frame's cracks to the mesh; once a frame, after every draw.

Returns ​

number


forget() ​

forget(eid): void

Defined in: apps/client/src/renderer/cracks.ts:211

The glass of the car eid clean again (its driver asked for it to be put back at a spawn).

Parameters ​

eid ​

number

Returns ​

void


keep() ​

keep(cars): void

Defined in: apps/client/src/renderer/cracks.ts:189

Keeps up with the cars of the latest snapshot: a car gone loses its cracks, one mended (its health back up), put back at a spawn (far from where it was) or of another class has clean glass again.

Parameters ​

cars ​

ReadonlyMap<number, CarState>

Returns ​

void


list() ​

list(): object[]

Defined in: apps/client/src/renderer/cracks.ts:168

Every car with cracks, and how many.

Returns ​

object[]


of() ​

of(eid): number

Defined in: apps/client/src/renderer/cracks.ts:163

How many cracks the car eid (its server entity id) has, for the tests.

Parameters ​

eid ​

number

Returns ​

number


shot() ​

shot(eid, car, shot, seated?): boolean

Defined in: apps/client/src/renderer/cracks.ts:221

A shot near the car eid (car: as the snapshot places it, with its health): it cracks the glass it stopped on, or, fired from inside (seated: the seat its shooter sits in, when one of the car's people fired), the glass it went out through. Returns whether a crack was left.

Parameters ​

eid ​

number

car ​

CarPose & object

shot ​

ShotLine

seated? ​

Seat

Returns ​

boolean