Skip to content

five-on-it / apps/server/src/cops-host / CopsHost

Class: CopsHost ​

Defined in: apps/server/src/cops-host.ts:133

The cops, the transports and the bounty board of one room (see the module documentation).

Constructors ​

Constructor ​

new CopsHost(options): CopsHost

Defined in: apps/server/src/cops-host.ts:154

Parameters ​

options ​

CopsHostOptions

Returns ​

CopsHost

Properties ​

bounties ​

readonly bounties: BountyBoard

Defined in: apps/server/src/cops-host.ts:135

The room's bounty board.

Methods ​

afterStep() ​

afterStep(events): void

Defined in: apps/server/src/cops-host.ts:293

After the step: the cops' outcomes (a cuff the run's catch and maybe a bounty's claim; a mission's person freed from a transport or arrived), the bounties claimed by hits that downed their carriers, the roles' perks.

Parameters ​

events ​

readonly SimEvent[]

Returns ​

void


crewOf() ​

crewOf(client): number[]

Defined in: apps/server/src/cops-host.ts:176

Who could free a player from a prison transport (M8): a co-op run's teammates, a versus run's when no team plays the police (there a cuff is the game's catch), else the members of the party they came with who are in the room.

Parameters ​

client ​

number

Returns ​

number[]


debugCop() ​

debugCop(client, character, on, dispatcher): void

Defined in: apps/server/src/cops-host.ts:388

A player made a cop outside a run (the debug command cop: the tests' way to the Dispatch app and the tactical map in free roam), the dispatcher held out of the world; or a cop no more.

Parameters ​

client ​

number

character ​

number

on ​

boolean

dispatcher ​

boolean

Returns ​

void


halt() ​

halt(): number

Defined in: apps/server/src/cops-host.ts:395

Every prison transport's van held where it is for a minute (the debug command halt).

Returns ​

number


held() ​

held(client): boolean

Defined in: apps/server/src/cops-host.ts:214

Whether a player's input is held: riding in the back of a prison transport (M8), or at the dispatcher's desk (P2).

Parameters ​

client ​

number

Returns ​

boolean


isDispatcher() ​

isDispatcher(client): boolean

Defined in: apps/server/src/cops-host.ts:206

Whether a player is the dispatcher (P2): held, out of the world.

Parameters ​

client ​

number

Returns ​

boolean


leave() ​

leave(client): void

Defined in: apps/server/src/cops-host.ts:251

A player left the room: their board, their cop's book, their frames forgotten.

Parameters ​

client ​

number

Returns ​

void


onMessage() ​

onMessage(client, text): boolean

Defined in: apps/server/src/cops-host.ts:223

A text frame of the cops' (an order, a role, the bounty board's switch); whether it was one. Nothing of the client's is trusted beyond what the AI and the run check.

Parameters ​

client ​

CopsClient

text ​

string

Returns ​

boolean


send() ​

send(): void

Defined in: apps/server/src/cops-host.ts:497

Each player's cops frame when it changed (every COPS_EVERY ticks); nothing to a player who never had one and has nothing.

Returns ​

void


sync() ​

sync(): void

Defined in: apps/server/src/cops-host.ts:264

Before the police's step: the run's police team's players made cops (the dispatcher held out of the world), a wanted team's stars pinned (P4), every other cop dropped.

Returns ​

void


view() ​

view(c): object

Defined in: apps/server/src/cops-host.ts:409

What a player sees of the cops (see CopsMessage).

Parameters ​

c ​

CopsClient

Returns ​

bounties ​

bounties: object

Whether their bounty board is on, and the room's bounties when it is.

bounties.list ​

list: object[]

bounties.on ​

on: boolean

cop? ​

optional cop?: object

Their dispatch, when they play the police.

cop.budget ​

budget: number = count

The team's budget now and at most (points).

cop.costs ​

costs: number[]

What each order costs (points), in COP_ORDERS' order.

cop.cuff? ​

optional cuff?: object

The cuffs under way: the robber's client id and how far along (0 to 1).

cop.cuff.client ​

client: number

cop.cuff.progress ​

progress: number

cop.dispatcher ​

dispatcher: boolean

Whether they took the Dispatcher's role (P2: orders at a point of the map).

cop.last? ​

optional last?: object

The answer to the cop's last order, and its number (one more each order).

cop.last.answer ​

answer: "rate" | "cooldown" | "failed" | "budget" | "ok" | "notCop" | "dispatcherOnly" | "noSuspect" | "noRoad" | "noBuilding" | "room"

cop.last.n ​

n: number = count

cop.last.order ​

order: "swat" | "roadblock" | "drone" | "cruiser"

cop.max ​

max: number = count

cop.ready ​

ready: number[]

The seconds before each order is the team's again, in COP_ORDERS' order.

cop.suspects ​

suspects: object[]

The robbers the police know of: where they last placed them (m), their stars, how long ago (s).

cop.units ​

units: object[]

The backup the team called that is still out: what, where (m), its seconds left.

transports ​

transports: object[]

The transports they ride or could stop.

type ​

type: "cops"