@korial29/tiny-fps 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import type { Light } from './lights';
2
+ import type { Vec3 } from './mesh';
3
+ /** Seconds a beam lasts, and a flash of light and a spark. */
4
+ export declare const LIFE = 0.08;
5
+ export interface Tracer {
6
+ /** A shot from `a` to `b`; `hit` when it ended on a wall, which sparks; `own` for the player's, which stays on its muzzle. */
7
+ shoot(a: Vec3, b: Vec3, hit: boolean, own?: boolean): void;
8
+ /** Where the own muzzle is now: the own beams start there, so that a kick of the view does not swing them. */
9
+ mount(a: Vec3): void;
10
+ /** Ages everything by dt seconds and drops what is over. */
11
+ update(dt: number): void;
12
+ /** Appends the ribbons and the sparks, turned to the camera at `eye`. */
13
+ draw(out: number[], eye: Vec3): void;
14
+ /** The lights of the flashes at the muzzles and the impacts, for gather(). */
15
+ lights(): Light[];
16
+ /** The beams alive now. */
17
+ readonly count: number;
18
+ }
19
+ export declare const createTracer: () => Tracer;
@@ -2,15 +2,25 @@ import type { PlayerState } from '../shared/types';
2
2
  import type { World } from '../shared/world';
3
3
  import type { Vec3 } from './mesh';
4
4
  import { solve } from './rig';
5
+ import type { Pose, Quat } from './rig';
5
6
  export type Solved = ReturnType<typeof solve>;
6
7
  export interface Body {
7
8
  /** The own player's id, -1 before the first snapshot. */
8
9
  readonly id: number;
9
- /** Advances dt seconds: the own player, eased (undefined before the first snapshot). */
10
- update(me: PlayerState | undefined, dt: number): void;
10
+ /** Advances dt seconds: the own player, eased (undefined before the first snapshot), the kick of the gun (0 to 1) and the aspect of the screen, which keeps the gun in a narrow one. */
11
+ update(me: PlayerState | undefined, dt: number, kick?: number, aspect?: number): void;
12
+ /** The muzzle of the gun in the right hand, in the camera's space (right, up, forward), as of the last update. */
13
+ muzzle(): Vec3;
11
14
  /** The joints for a camera at `eye`; undefined without a player, or with the camera away from the body. */
12
15
  pose(eye: Vec3, yaw: number, pitch: number, roll?: number): Solved | undefined;
13
16
  /** Appends the body's vertices (see STRIDE) in the jacket `color`; nothing when pose() has none. */
14
17
  draw(out: number[], eye: Vec3, yaw: number, pitch: number, roll?: number, color?: number[]): void;
15
18
  }
19
+ export declare const inv: ([x, y, z, w]: Quat) => Quat;
20
+ /**
21
+ * Turns the limb of root joint j (a shoulder, a hip) in `q` so that its end reaches `to`, the
22
+ * middle joint toward `pole`. `s` is q solved: the bones keep their twist and swing the shortest
23
+ * way. The end joint keeps its own turn in the world (a foot stays flat) or follows the bone (a hand).
24
+ */
25
+ export declare const reach: (q: Pose, s: Solved, j: number, to: Vec3, pole: Vec3, flat?: boolean) => void;
16
26
  export declare const createBody: (world?: World) => Body;
@@ -0,0 +1,28 @@
1
+ import type { PlayerState } from '../shared/types';
2
+ import type { World } from '../shared/world';
3
+ import type { Audio } from './audio';
4
+ import type { Tracer } from './beams';
5
+ import type { Effects } from './effects';
6
+ import type { Hud } from './hud';
7
+ import type { Vec3 } from './mesh';
8
+ /** What the frame draws from: the own eye and the camera (the eye plus the shake), the look, the own muzzle in the camera's space. */
9
+ export interface View {
10
+ eye: Vec3;
11
+ cam: Vec3;
12
+ yaw: number;
13
+ pitch: number;
14
+ /** The pitch the camera draws at: the look plus the shake. */
15
+ drawn: number;
16
+ muzzle: Vec3;
17
+ }
18
+ export interface Combat {
19
+ /** One live step of the own player, its state before and after: the recoil and the kick of each shot it fired. */
20
+ step(a?: PlayerState, b?: PlayerState): void;
21
+ /** One frame: the beams and the sounds of what changed since the last one, and the HUD. */
22
+ frame(v: View | undefined, me: PlayerState | undefined, others: PlayerState[], keys: number, dt: number): void;
23
+ }
24
+ /** Shots between two states of a player, a u8 counter that wraps. */
25
+ export declare const fired: (a?: PlayerState, b?: PlayerState) => number;
26
+ export declare const createCombat: (world: World, audio: Pick<Audio, "play">, hud: Pick<Hud, "vitals" | "hit" | "down">, fx: Pick<Effects, "fire" | "wound" | "lie">, tracer: Pick<Tracer, "shoot" | "update" | "mount">, ctl: {
27
+ pitch: number;
28
+ }) => Combat;
@@ -19,6 +19,14 @@ export interface Effects {
19
19
  stride: number;
20
20
  /** 0 to 1: the red vignette of a tackle, full at the hit and gone in under a second. */
21
21
  hurt: number;
22
+ /** 0 to 1: the kick of the gun in the hand, full at a shot and gone in a tenth of a second. */
23
+ kick: number;
24
+ /** 0 to 1: how far the view has gone down to the floor, while the own player is down. */
25
+ lie: number;
26
+ /** The own player fired: a small shake of the eye, the look and the roll, and the kick of the gun. */
27
+ fire(): void;
28
+ /** The own player was hit by a laser: the red vignette and a small knock. */
29
+ wound(): void;
22
30
  /** The own player was tackled: a hard jolt of the eye, the look and the roll, and the vignette. */
23
31
  jolt(): void;
24
32
  /** The own player tackled someone: a small punch of the look and the field of view. */
@@ -17,15 +17,26 @@ export interface FlagDraw {
17
17
  }
18
18
  /** Height of a pole, metres. */
19
19
  export declare const POLE = 2.4;
20
+ /** The glow of an unlit part, as a multiple of its colour: above 1 it blooms. */
21
+ export declare const GLOW = 2.2;
20
22
  /** A team's colour as RGB in 0..1: TEAM_COLOR is always #rrggbb. */
21
23
  export declare const teamRgb: (team: number) => number[];
22
24
  /** What the renderer draws of the match: the base of each team and the flags in play. */
23
25
  export interface CtfScene {
24
26
  bases: readonly Vec3[];
25
27
  flags: readonly FlagDraw[];
28
+ /** Each team's gun rack, where it has one, and the health packs that are there to take. */
29
+ racks?: readonly (Vec3 | undefined)[];
30
+ packs?: readonly Vec3[];
26
31
  }
27
32
  /** The flags to draw from a snapshot: each at its base, where it lies, or on the back of its carrier (none if he is not drawn). */
28
33
  export declare const flagDraws: (flags: readonly FlagState[], bases: readonly Vec3[], who: (id: number) => PlayerState | undefined) => FlagDraw[];
34
+ /** Makes the vertices from `from` on glow: the colour gets brighter by `k` and loses its shading. */
35
+ export declare const glow: (out: number[], from: number, k: number) => void;
36
+ /** A triangle with its flat normal, of one colour (r, g, b). */
37
+ export declare const tri: (out: number[], a: Vec3, b: Vec3, c: Vec3, [r, g, bl]: number[]) => void;
38
+ /** A ring between the radii r0 and r1 on the horizontal at `at`, facing up: SIDES quads. */
39
+ export declare const ring: (out: number[], at: Vec3, r0: number, r1: number, rgb: number[]) => void;
29
40
  /**
30
41
  * A team's base at `at`: a low pad of the team colour under a glowing ring of FLAG_REACH, the
31
42
  * radius within which a flag is touched and a capture counts. `t` is the clock in seconds: the
@@ -1,5 +1,6 @@
1
1
  import type { PlayerState } from '../shared/types';
2
- import type { Pose } from './rig';
2
+ import type { Vec3 } from './mesh';
3
+ import type { Pose, Quat } from './rig';
3
4
  /** The height of the ground at (x, z), for feet that stand on stairs and slopes. */
4
5
  export type Floor = (x: number, z: number) => number;
5
6
  export interface Gait {
@@ -12,6 +13,8 @@ export interface Gait {
12
13
  /** Footsteps so far. */
13
14
  readonly steps: number;
14
15
  }
16
+ /** The rotation whose x axis is `x` and whose y axis points up the bone, opposite to `d`. */
17
+ export declare const frame: (x: Vec3, d: Vec3) => Quat;
15
18
  /** The moves other than the stride, in layering order: a later one covers an earlier one. */
16
19
  export declare const MOVE: {
17
20
  readonly AIR: 0;
@@ -24,6 +27,8 @@ export declare const MOVE: {
24
27
  readonly SLIDE: 7;
25
28
  readonly STUN: 8;
26
29
  readonly TUCK: 9;
30
+ /** Out of health: the knees give and the body topples (see `lie` in build). */
31
+ readonly DOWN: 10;
27
32
  };
28
33
  /**
29
34
  * A move's pose, in radians (metres for the offsets): drop of the pelvis, lean forward, lean to the
@@ -0,0 +1,21 @@
1
+ import type { PlayerState } from '../shared/types';
2
+ import type { Vec3 } from './mesh';
3
+ import type { Quat } from './rig';
4
+ /** Where the muzzle is, between the two jaws; and the grip's tilt: its lower end goes back by TILT[0] for each TILT[1] down. */
5
+ export declare const MUZZLE: Vec3;
6
+ export declare const TILT: number[];
7
+ /**
8
+ * The gun at a level of detail (0 far, 1 near), built once, in the vertex format of mesh.ts, after
9
+ * the Halo plasma pistol: a bulbous upper body that splits into two jaws around a glowing
10
+ * emitter, a chunky lower shell under the hand, a short thick grip between them, ridges and a fin
11
+ * on the back, and cyan strips along the sides.
12
+ */
13
+ export declare const gun: (lod: number) => number[];
14
+ /** The middle of the grip, for a wrist at `pos`: 8 cm along the fingers and 2 cm toward the palm. */
15
+ export declare const grip: (pos: Vec3, q: Quat) => Vec3;
16
+ /** Appends the gun held in the hand at `pos` with the world rotation `q`, `k` times its size about the grip. */
17
+ export declare const held: (out: number[], pos: Vec3, q: Quat, lod: number, k?: number) => void;
18
+ /** The muzzle of a gun whose grip is at `at` and whose axes are [right, up, forward]. */
19
+ export declare const tip: (at: Vec3, [, u, f]: Vec3[]) => Vec3;
20
+ /** Where a runner holds the gun when it fires: the grip, a little right of and below the eye, and the gun's axes along the look. */
21
+ export declare const aimed: (p: PlayerState) => [Vec3, Vec3[]];
@@ -21,13 +21,20 @@ export interface Hud {
21
21
  marks(list: Mark[]): void;
22
22
  /** The red vignette of a tackle, 0 (none) to 1 (full). */
23
23
  hurt(level: number): void;
24
+ /** The health as pips out of HP_MAX, and the ammo counter with the gun glyph; -1 ammo (no gun) hides the counter. */
25
+ vitals(hp: number, ammo: number): void;
26
+ /** A hit marker on the crosshair for a moment: a laser of the own player hit. */
27
+ hit(): void;
28
+ /** The state of being down: `level` 0 (up) to 1 hides or greys the screen, `left` seconds till the respawn. */
29
+ down(level: number, left: number): void;
24
30
  /** A line in the middle of the top of the screen in `team`'s colour, for a few seconds; a newer one replaces it. */
25
31
  banner(text: string, team?: number): void;
26
32
  /** The end screen with the result and each player's captures and returns, `next` seconds before the next match; undefined hides it. */
27
33
  end(sum: Summary | undefined, next: number): void;
28
34
  }
29
- /** Milliseconds a banner stays. */
35
+ /** Milliseconds a banner stays, and a hit marker. */
30
36
  export declare const BANNER_MS = 2800;
37
+ export declare const HIT_MS = 140;
31
38
  /** m:ss. */
32
39
  export declare const clock: (s: number) => string;
33
40
  /** Appends the HUD to `screen`, whose stylesheet has HUD_CSS. */
@@ -26,6 +26,6 @@ export interface Controls {
26
26
  /**
27
27
  * Click the canvas to lock the pointer; while locked the mouse looks, the keys move (WASD, Shift
28
28
  * sprints, Space jumps, C crouches, a direction key pressed twice within DOUBLE_TAP_MS dashes that
29
- * way) and M calls `onMute`.
29
+ * way, the left button fires) and M calls `onMute`.
30
30
  */
31
31
  export declare const createInput: (canvas: HTMLCanvasElement, onMute?: () => void) => Controls;
@@ -0,0 +1,7 @@
1
+ import type { Vec3 } from './mesh';
2
+ /** The health packs of `all` whose bit is set in `mask`, if any: the ones that are there to take. */
3
+ export declare const packsOf: (all?: readonly Vec3[], mask?: number) => Vec3[];
4
+ /** A rack at `at` (a point on a top): a post and a dish, a ring on the roof of the radius that gives the gun, the gun over it. */
5
+ export declare const rack: (out: number[], at: Vec3, rgb: number[], t: number) => void;
6
+ /** A health pack at `at` (on a top): a box turning and bobbing a little over it, a green cross glowing on each side. */
7
+ export declare const kit: (out: number[], at: Vec3, t: number) => void;
@@ -1,6 +1,7 @@
1
1
  import type { PlayerState } from '../shared/types';
2
2
  import type { World, WorldDef } from '../shared/world';
3
3
  import type { Body } from './body';
4
+ import type { Tracer } from './beams';
4
5
  import type { Effects } from './effects';
5
6
  import type { CtfScene } from './flag';
6
7
  import type { Light } from './lights';
@@ -89,8 +90,10 @@ export interface Renderer {
89
90
  frame(eye: Vec3, yaw: number, pitch: number, others: PlayerState[], colors: ReadonlyMap<number, string>, fx: Effects,
90
91
  /** gather() in lights.ts: at most MAX_LIGHTS, the first MAX_SHADOWS shadowed spots mapped, besides the sun. */
91
92
  lights: Light[], body?: Body,
92
- /** The bases and the flags: drawn lit, casting shadows, with the other players. */
93
- ctf?: CtfScene): void;
93
+ /** The bases, the flags, the racks and the health packs: drawn lit, casting shadows, with the other players. */
94
+ ctf?: CtfScene,
95
+ /** The laser beams: glowing ribbons that cast no shadow. */
96
+ tracer?: Tracer): void;
94
97
  /** A world point on screen as of the last frame, in [0, 1] from the top left. */
95
98
  project(x: number, y: number, z: number): [number, number] | undefined;
96
99
  destroy(): void;
@@ -40,6 +40,14 @@ export declare const SOUND: {
40
40
  /** A tackle: the impact, and the grunt of the one tackled. */
41
41
  readonly TACKLE: 14;
42
42
  readonly GRUNT: 15;
43
+ /** The gun: a shot, the shooter's hit sound, hurt, going down, taking the gun or a refill, a health pack, an empty click. */
44
+ readonly LASER: 16;
45
+ readonly HIT: 17;
46
+ readonly HURT: 18;
47
+ readonly DOWN: 19;
48
+ readonly GUN: 20;
49
+ readonly PACK: 21;
50
+ readonly DRY: 22;
43
51
  };
44
52
  /**
45
53
  * The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
@@ -8,6 +8,9 @@ export interface Runner {
8
8
  gait: Gait;
9
9
  /** How much of a dash it is in, eased from 0 to 1: the length of the streaks. */
10
10
  dash: number;
11
+ /** Seconds since its last shot, and how far its gun arm is raised to aim, eased from 0 to 1. */
12
+ since: number;
13
+ aim: number;
11
14
  }
12
15
  /** A runner as first seen: in the pose its state asks for, no ease. */
13
16
  export declare const createRunner: (p: PlayerState) => Runner;
@@ -165,6 +165,26 @@ export declare const FLAG_REACH = 1.5;
165
165
  export declare const FLAG_H = 2.2;
166
166
  /** Seconds a dropped flag lies before it goes home by itself. */
167
167
  export declare const FLAG_RETURN = 10;
168
+ /** Health of a player; a hit takes 1, so HP_MAX hits put him down. */
169
+ export declare const HP_MAX = 5;
170
+ /** Shots the rack loads. */
171
+ export declare const AMMO_MAX = 60;
172
+ /** Ticks between two shots while the trigger is held: 8.6 shots a second. */
173
+ export declare const GUN_COOLDOWN = 7;
174
+ /** Metres a laser reaches. */
175
+ export declare const GUN_RANGE = 80;
176
+ /** Radians the view kicks up per shot (client side: the kick is in the pitch the inputs carry). */
177
+ export declare const RECOIL = 0.012;
178
+ /** Ticks a player lies down after the health ran out, then he is back at a spawn of his team. */
179
+ export declare const DOWN_TICKS = 120;
180
+ /** Health a pack gives, up to HP_MAX, and seconds before a taken pack is back. */
181
+ export declare const PACK_HP = 2;
182
+ export declare const PACK_BACK = 20;
183
+ /** Metres from a pack or a rack, feet to point on the floor plane, that take it. */
184
+ export declare const PACK_R = 0.9;
185
+ export declare const RACK_R = 1.2;
186
+ /** Metres the feet may be above or below a pack or a rack to take it. */
187
+ export declare const PICK_H = 1;
168
188
  /** Seconds a carrier who is made to drop the flag cannot take it again: he would pick it up where he stands. */
169
189
  export declare const FLAG_LOCK = 2;
170
190
  /** Seconds the end screen of a match stays, then a new match starts. */
@@ -0,0 +1,22 @@
1
+ import type { Input, PlayerState } from './types';
2
+ import type { World } from './world';
3
+ type Vec3 = [number, number, number];
4
+ /** Whether the feet of `p` are within `r` of the point `at` on the floor plane and within PICK_H of its height. */
5
+ export declare const within: (p: PlayerState, at: Vec3, r: number) => boolean;
6
+ /**
7
+ * One input: the move, then the gun. Returns whether a shot went off, for the host to resolve it.
8
+ * - Down: the keys are dropped, and when `down` runs out the player is back at a spawn.
9
+ * - The team's rack fills the gun when the player steps into its circle (`rack` tells he is in it),
10
+ * and again each time he comes back; staying gives nothing.
11
+ * - The trigger: `cool` runs down, and at 0 a held FIRE with ammo fires, unless the hands are busy
12
+ * (a hang, a climb). The look is the input's, so the shot goes where the player sees.
13
+ * `armed` is false while the match is over: no gun, no rack.
14
+ */
15
+ export declare const step: (p: PlayerState, i: Input, w: World, team: number, armed?: boolean) => boolean;
16
+ /**
17
+ * The first of `foes` (the players he may hit, as he saw them) that the laser of `p` meets: from his
18
+ * eye along his look, at most GUN_RANGE and not through a brush. `p` is the state after the input
19
+ * that fired.
20
+ */
21
+ export declare const shoot: (w: World, p: PlayerState, foes: PlayerState[]) => PlayerState | undefined;
22
+ export {};
@@ -20,11 +20,23 @@ export declare const STILL: {
20
20
  coyote: number;
21
21
  buffer: number;
22
22
  held: number;
23
+ hp: number;
24
+ ammo: number;
25
+ cool: number;
26
+ rack: boolean;
27
+ down: number;
28
+ shots: number;
29
+ hits: number;
23
30
  ev: number;
24
31
  fall: number;
25
32
  };
26
33
  /** A player standing on spawn point n of a team (modulo the count): the red team's by default. */
27
34
  export declare const spawn: (id: number, w: World, n: number, team?: number) => PlayerState;
35
+ /**
36
+ * Puts the player back at the spawn of his id in his team, looking where he looked, with full
37
+ * health and no gun (EV.RESPAWN). The shot and hit counters go on: a reset would read as a shot.
38
+ */
39
+ export declare const respawn: (p: PlayerState, w: World, team: number) => void;
28
40
  /** The height of the cylinder in this mode. */
29
41
  export declare const heightOf: (p: Pick<PlayerState, "mode">) => number;
30
42
  /** The camera height above the feet in this mode. */
@@ -26,11 +26,11 @@ export type ServerText = {
26
26
  };
27
27
  export declare const MSG_INPUT = 1;
28
28
  export declare const MSG_SNAPSHOT = 2;
29
- export declare const INPUT_BYTES = 11;
29
+ export declare const INPUT_BYTES = 12;
30
30
  export declare const SNAP_HEAD = 4;
31
- export declare const SNAP_PLAYER = 40;
32
- /** The match block after the players: the captures, the clock; the flags follow (2 to 16 bytes). */
33
- export declare const SNAP_MATCH = 4;
31
+ export declare const SNAP_PLAYER = 45;
32
+ /** The match block after the players: the captures, the clock, the packs; the flags follow (2 to 16 bytes). */
33
+ export declare const SNAP_MATCH = 8;
34
34
  /**
35
35
  * The input as the host will read it after encodeInput and decodeInput: yaw, pitch and view
36
36
  * rounded to the wire (an absent view stays absent here, and reads 0 on the host). The client
@@ -29,6 +29,8 @@ export declare class Room {
29
29
  private rules;
30
30
  /** Round-robin cursor over the spawn points of each team, used once they are all taken. */
31
31
  private rr;
32
+ /** Ticks before each health pack of the map is back: 0 when it is there to take. */
33
+ private gone;
32
34
  /** Missing rules fall back to RULES. */
33
35
  constructor(rules?: Partial<Rules>, map?: WorldDef);
34
36
  /** Number of joined players. */
@@ -69,6 +71,14 @@ export declare class Room {
69
71
  * tackler goes. Once per TACKLE_COOLDOWN ticks, for the first carrier hit.
70
72
  */
71
73
  private tackle;
74
+ /**
75
+ * A shot of `p` went off at the view tick `view`: it hits the first enemy on its way as `p` drew
76
+ * him (lag compensation), unless he lies down now or did then. A hit takes 1 hp; the last one puts
77
+ * him down: he lies where he fell, without the gun, and a flag he carries drops with the lock.
78
+ */
79
+ private shoot;
80
+ /** The packs: one that is gone comes back after PACK_BACK s; a hurt player standing at one takes it. */
81
+ private heal;
72
82
  /** The first spawn point of the team with none of `others` within SPAWN_CLEAR, else the next one round-robin. */
73
83
  private place;
74
84
  /** The match is over: everyone gets the result and what each player did. */
@@ -30,6 +30,8 @@ export declare const KEY: {
30
30
  readonly DASH: 64;
31
31
  /** Hold to crouch, or to slide when fast. */
32
32
  readonly CROUCH: 128;
33
+ /** Hold to fire the gun: one shot every GUN_COOLDOWN ticks while there is ammo. */
34
+ readonly FIRE: 256;
33
35
  };
34
36
  /** The movement state of a player: what the body is doing, one of these. */
35
37
  export declare const MODE: {
@@ -132,6 +134,19 @@ export interface PlayerState {
132
134
  buffer: number;
133
135
  /** KEY.JUMP and KEY.DASH as held in the last step, to tell a press from a hold. */
134
136
  held: number;
137
+ /** Health, 0 to HP_MAX. */
138
+ hp: number;
139
+ /** Shots left in the gun; -1 without the gun (taken at the team's rack, lost on death). */
140
+ ammo: number;
141
+ /** Ticks to the next shot. */
142
+ cool: number;
143
+ /** Standing inside the circle of the team's rack as of the last step: the gun is filled on arrival only. Absent reads false. */
144
+ rack?: boolean;
145
+ /** Ticks left lying down after the health ran out; at 0 the player is back at a spawn. 0 when up. */
146
+ down: number;
147
+ /** Shots fired and hits landed, u8 counters that wrap: the clients draw a beam and play the hit sound on each change. */
148
+ shots: number;
149
+ hits: number;
135
150
  /** For the animation, not sent: the EV bits of the last step, and the speed of a landing. */
136
151
  ev: number;
137
152
  fall: number;
@@ -190,6 +205,8 @@ export interface Snapshot {
190
205
  over: boolean;
191
206
  /** The flag of each team, red then blue. */
192
207
  flags: [FlagState, FlagState];
208
+ /** Bit n set: health pack n of WorldDef.packs is there to take. Absent: none. */
209
+ packs?: number;
193
210
  }
194
211
  /** Room rules, set by the host. Defaults in constants.ts (RULES). */
195
212
  export interface Rules {
@@ -18,6 +18,8 @@ export interface TeamDef {
18
18
  base: Vec3;
19
19
  /** Where its players start, and come back to after a fall. */
20
20
  spawns: Spawn[];
21
+ /** The gun rack near the spawns, a point on a top: walking within RACK_R gives the gun with AMMO_MAX shots. */
22
+ rack?: Vec3;
21
23
  }
22
24
  export interface WorldDef {
23
25
  /** Shown on the title screen. */
@@ -27,6 +29,8 @@ export interface WorldDef {
27
29
  teams: [red: TeamDef, blue: TeamDef];
28
30
  /** Feet below this height have fallen off the roofs: the player is put back at a spawn of the team. */
29
31
  floor: number;
32
+ /** Health packs, points on tops (at most 32): walking within PACK_R gives PACK_HP, then it is gone PACK_BACK seconds. */
33
+ packs?: Vec3[];
30
34
  /** Unit direction toward the sun, and its colour (linear RGB, may exceed 1). */
31
35
  sun: {
32
36
  dir: Vec3;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@korial29/tiny-fps",
3
3
  "description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.25.1",
5
+ "version": "0.26.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"