entry(key: string, name: string, team: string?, bot: boolean?) → Entry
A fresh board entry.
| arg | type | description |
|---|
| key | string | |
| name | string | |
| team | string? | |
| bot | boolean? | |
resetBoard(board: Board) → void
Zero every entry's numbers for a new match, keeping who is on the board.
| arg | type | description |
|---|
| board | Board | |
sorted(board: Board) → void
Rows sorted for display: score, then frags, then fewest deaths, then name.
| arg | type | description |
|---|
| board | Board | |
ratio(e: Entry) → number
Frags-per-death as shown on the board (frags when never killed).
streakCall(n: number) → string
The callout a streak earns, or nil.
| arg | type | description |
|---|
| n | number | |
frag(board: Board, mode: any, killer: string?, victim: string, teamsOn: boolean, melee: boolean?, ladderLen: number?) → FragResult
Apply one frag to the board under `mode` (a fragKit.modes entry). `killer` may be nil (the world killed them). `melee` says the frag was a melee hit. `ladderLen` is the gun game ladder's length. Returns what the frag is worth so the caller can report it to the match.
| arg | type | description |
|---|
| board | Board | |
| mode | any | |
| killer | string? | |
| victim | string | |
| teamsOn | boolean | |
| melee | boolean? | |
| ladderLen | number? | |
boardKey(id: string?, isBot: boolean, ownerPeer: number?) → string
The board key of a body: "b<id>" for a bot, "p<peer>" for a player's body (its owner peer), nil when it is neither (a prop, a trap, an unowned thing).
| arg | type | description |
|---|
| id | string? | |
| isBot | boolean | |
| ownerPeer | number? | |
creditKill(board: Board, killerKey: string?, victimKey: string, mode: any?, teamsOn: boolean) → Credit
Who gets the credit for one death, players and bots alike. `killerKey` and `victimKey` are board keys (R.boardKey); `killerKey` is nil when the world killed them (a fall, a trap). `mode` is a fragKit.modes entry (kept for modes that change who is credited). Returns { kind, killer, victim }: "none" when the victim is not on the board (nothing to score), "world" when there is no killer on the board, "self" for a self-frag, "team" for a teammate's frag with teams on (no credit), otherwise "frag" with the killer credited. R.frag applies the frag to the board; pass it `credit.killer` only when kind is "frag" or "team".
| arg | type | description |
|---|
| board | Board | |
| killerKey | string? | |
| victimKey | string | |
| mode | any? | |
| teamsOn | boolean | |
standings(board: Board, teamsOn: boolean, teamScores: { [string]: number }?) → any
The final standings for a results screen: board rows in display order (R.sorted) with their place (ties on score, frags and deaths share one), and the winner: the best player or bot in free-for-all, the team with the most score with teams on ("" when it is a draw). `teamScores` maps team to score; when it is nil the team's members' scores are summed.
| arg | type | description |
|---|
| board | Board | |
| teamsOn | boolean | |
| teamScores | { [string]: number }? | |
tagScores(collectorTeam: string, victimTeam: string, teamsOn: boolean) → boolean
Kill confirmed: whether `collectorTeam` grabbing a tag dropped by a victim of `victimTeam` confirms (scores) or denies it. In free-for-all every tag confirms.
| arg | type | description |
|---|
| collectorTeam | string | |
| victimTeam | string | |
| teamsOn | boolean | |
dist2(a: any, b: any) → number
| arg | type | description |
|---|
| a | any | |
| b | any | |
pickSpawn(spawns: { any }, team: string, enemies: { any }, occupied: { any }?, seed: number?) → void
Pick the spawn to use. `spawns` = { { pos = {x,y,z}, yaw, team } }; `team` = the spawner's team ("" in free-for-all); `enemies` = positions { {x,y,z} } of living enemies; `occupied` = positions of anyone (friends too) to keep clear of; `seed` breaks ties. Picks among the team's own spawns when it has some, else any; the spawn whose nearest enemy is farthest wins, never one within 3 m of anybody when another is free. Returns the spawn and its index.
| arg | type | description |
|---|
| spawns | { any } | |
| team | string | |
| enemies | { any } | |
| occupied | { any }? | |
| seed | number? | |
botSpawnPoints(spawns: { any }, teamsOn: boolean) → void
The points a bot comes back to life at (handed to arenaBots.setSpawnPoints): with teams on, the arena's team spawns (each bot uses its own team's); otherwise the free-for-all ones. When the arena has none of that kind, every spawn, on no team. `spawns` = { { pos, yaw, team } }.
| arg | type | description |
|---|
| spawns | { any } | |
| teamsOn | boolean | |
balanceTeams(board: { [string]: any }, order: { string }, a: string?, b: string?) → void
Even out two teams by moving bots only. `board` maps keys to entries ({ team, bot }); `order` lists the bot keys in the order they may move. Moves a bot from the bigger team to the smaller while the difference is more than one, counting players and bots. Returns { [key] = newTeam } for the bots it moved; the board is not changed.
| arg | type | description |
|---|
| board | { [string]: any } | |
| order | { string } | |
| a | string? | |
| b | string? | |