@korial29/tiny-fps 0.129.0 → 0.130.1

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.
@@ -198,6 +198,11 @@ export declare class Room {
198
198
  * while it has any, from the left pod then the right, toward where its lasers cross.
199
199
  */
200
200
  private launch;
201
+ /**
202
+ * What the look of the driver `p` meets for his guns' aim (aimOf()): a brush, an enemy vehicle's
203
+ * hull where it is, or an enemy on foot who is up as `p` drew him at the input's view tick.
204
+ */
205
+ private sight;
201
206
  /**
202
207
  * A vehicle's clock outside its driver's inputs: a wreck is parked afresh after VEHICLE.WRECK
203
208
  * ticks; a hull the rail gun's bolt sears loses 1 hp each RAIL_DRAIN ticks after its first touch;
@@ -208,6 +213,12 @@ export declare class Room {
208
213
  private teamOf;
209
214
  /** The vehicles a shooter of `team` hurts: whole, and not of his team. */
210
215
  private targets;
216
+ /**
217
+ * A vehicle that crashed with a jolt of `jolt` m/s: a ship into a brush, the ground or another
218
+ * vehicle (pilot()), a rover into a wall or a vehicle (drive()). 1 hp each CRASH_HP past CRASH
219
+ * (SHIP's, ROVER's), nobody's shot; at 0 it blows up as its team's, so its blast spares its mates.
220
+ */
221
+ private crash;
211
222
  /** The vehicle `r` loses `hp` to player `by` of `team`; at 0 it blows up (wreck()). */
212
223
  private hurt;
213
224
  /**
@@ -53,6 +53,12 @@ export declare const ROVER: {
53
53
  readonly WHEEL_STEP: 0.6;
54
54
  /** The share of its speed into another rover a rover bounces back with. */
55
55
  readonly BOUNCE: 0.3;
56
+ /**
57
+ * A crash (the user, 2026-11-12): the speed on the level that a step's walls and vehicles take
58
+ * away (m/s) past CRASH costs 1 hp each CRASH_HP more. A landing is the springs': no crash.
59
+ */
60
+ readonly CRASH: 10;
61
+ readonly CRASH_HP: 3;
56
62
  /** A player this close to a rover's centre gets in; a rover this fast hurts an enemy, and this fast puts him down. */
57
63
  readonly ENTER_R: 3;
58
64
  readonly SPLAT_MIN: 6;
@@ -80,6 +86,8 @@ export declare const footprint: (r: Rover) => Vec3[];
80
86
  * rear circles of footprint(), RB wide and BODY_H tall. A player walks into it and stands on it.
81
87
  */
82
88
  export declare const hull: (r: Rover) => Body;
89
+ /** Every solid of the vehicle: a rover's hull(), a ship's hull and its two wings. */
90
+ export declare const hulls: (r: Rover) => Body[];
83
91
  /**
84
92
  * A rover's wreck skids to a stop where it blew up: before each of its steps with nobody at the
85
93
  * wheel it keeps VEHICLE.SKID of its speed along the ground. A ship's wreck falls as it flew.
@@ -131,7 +139,7 @@ export declare const slashed: (w: World, r: Rover, p: PlayerState, { reach, arc
131
139
  * turns toward the look as fast as the speed allows, and the tyres' grip decides how much of the
132
140
  * speed follows it. The rest drifts.
133
141
  */
134
- export declare const drive: (r: Rover, i: Input | undefined, w: World, fleet?: readonly Rover[]) => boolean;
142
+ export declare const drive: (r: Rover, i: Input | undefined, w: World, fleet?: readonly Rover[], crash?: (jolt: number) => void) => boolean;
135
143
  /**
136
144
  * Puts the body of a player on seat `s` (0 the driver's, 1 the rider's) of the rover, with its
137
145
  * speed. The seat leans with the body: on a slope he is not left in the air.
@@ -155,7 +163,7 @@ export declare const leave: (p: PlayerState, r: Rover, s: 0 | 1, w: World) => vo
155
163
  * that takes him off his seat (move() puts a body under the kill floor back at a spawn) frees it.
156
164
  * `fleet` is drive()'s.
157
165
  */
158
- export declare const ride: (p: PlayerState, r: Rover, i: Input, w: World, team: number, fleet?: readonly Rover[]) => boolean;
166
+ export declare const ride: (p: PlayerState, r: Rover, i: Input, w: World, team: number, fleet?: readonly Rover[], crash?: (jolt: number) => void) => boolean;
159
167
  /** The squared distance on the floor plane from the vehicle's centre to the player. */
160
168
  export declare const gap2: (r: Rover, p: {
161
169
  x: number;
@@ -177,18 +185,29 @@ export declare const nearby: (r: Rover, p: {
177
185
  export declare const free: (r: Rover, carrier: boolean) => 0 | 1 | -1;
178
186
  /** Metres from the centre to where the lasers cross along the look: a ship's or a rover's. */
179
187
  export declare const aimRange: (r: Rover) => number;
180
- /** Where the lasers cross: aimRange() metres from the centre along the driver's look. */
181
- export declare const aimOf: (r: Rover, yaw: number, pitch: number) => [number, number, number];
188
+ /**
189
+ * What the driver's look meets from the vehicle's centre along the unit `d`, within `max` metres:
190
+ * the distance, or Infinity. The room's sight(), the client's reticle.
191
+ */
192
+ export type Sight = (o: Vec3, d: Vec3, max: number) => number;
193
+ /** The lasers never cross nearer than this: the beams would fly sideways. */
194
+ export declare const AIM_MIN = 8;
195
+ /**
196
+ * Where the lasers cross: on what the driver's look meets within the guns' range (`sight`, the
197
+ * user, 2026-11-12: with a cross at a fixed distance the two beams went either side of a rover
198
+ * nearer than it), AIM_MIN at least; else aimRange() metres from the centre along the look.
199
+ */
200
+ export declare const aimOf: (r: Rover, yaw: number, pitch: number, sight?: Sight) => [number, number, number];
182
201
  /**
183
202
  * The two bolts of one salvo of the rover's lasers, left then right: each from its muzzle toward
184
203
  * the point GUN_AIM metres along the driver's look (the yaw and pitch of his input) from the rover's
185
204
  * centre, so the beams cross there, chest high on level ground with a level look. `id` names the first, `id + 1` the second.
186
205
  */
187
- export declare const bolts: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number) => Flying[];
206
+ export declare const bolts: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, sight?: Sight) => Flying[];
188
207
  /**
189
208
  * A ship's missile from its pod `k` (0 left, 1 right) toward where its lasers cross: a grenade
190
209
  * (plasma.ts's toss() flies it, blast() is its burst) launched at MISSILE_SPEED plus the ship's own
191
210
  * speed along the way, 63 m/s at most (the wire's six bits).
192
211
  */
193
- export declare const missile: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, k: number) => Flying;
212
+ export declare const missile: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, k: number, sight?: Sight) => Flying;
194
213
  export {};
@@ -56,10 +56,25 @@ export declare const SHIP: {
56
56
  readonly MISSILE_COOL: 30;
57
57
  readonly RELOAD: 300;
58
58
  readonly MISSILE_SPEED: 60;
59
+ /**
60
+ * A crash (the user, 2026-11-12): the speed a step's collisions take away (m/s, the vertical
61
+ * part halved, so a sink onto a pad is no crash) past CRASH costs 1 hp each CRASH_HP more.
62
+ */
63
+ readonly CRASH: 12;
64
+ readonly CRASH_HP: 4;
65
+ /** How much of the speed into another vehicle comes back off it. */
66
+ readonly BOUNCE: 0.3;
59
67
  };
60
68
  /** The lasers' muzzles under the wings, the missiles' pods under the wings: right of the centre, above it, ahead of it. */
61
69
  export declare const SHIP_GUNS: number[][];
62
70
  export declare const PODS: number[][];
71
+ /**
72
+ * A wing's sections, at the hull, at the cannon and at the tip: right, the leading and the trailing
73
+ * edge ahead, the top and the bottom. craft.ts draws them; the shots, the players on foot, the
74
+ * other vehicles and the brushes meet them (the user, 2026-11-12: the wings went through all).
75
+ */
76
+ export declare const WING: number[][];
77
+ export declare const WING_BOXES: [number, number][][];
63
78
  /** The pilot's seat in the cockpit, behind the long nose: right of the centre, above it (the feet), ahead of it. */
64
79
  export declare const COCKPIT: number[];
65
80
  /** Where who gets out stands, beside the cockpit: clear of the hull, ahead of the wings. */
@@ -76,6 +91,10 @@ export declare const dock: (ships?: readonly Spawn[]) => Rover[];
76
91
  * along the floor plane, R wide, from the skids up H. A player walks into it and stands on it.
77
92
  */
78
93
  export declare const shipHull: (r: Rover) => Body;
94
+ /** The wings as solids (WING_BODY), the left one then the right one. */
95
+ export declare const wings: (r: Rover) => Body[];
96
+ /** Every solid of the ship: its hull, then its wings. */
97
+ export declare const shipBodies: (r: Rover) => Body[];
79
98
  /**
80
99
  * How near the ship is to its limits, each 0 inside and 1 at the limit (more past it): the ceiling
81
100
  * and the edge of the crater. For the HUD.
@@ -92,12 +111,12 @@ export declare const limits: (r: Pick<Rover, "x" | "y" | "z">, w: World) => [up:
92
111
  * the engines hold it against gravity: it hovers with no key held. On a floor it rests on its
93
112
  * skids, level.
94
113
  */
95
- export declare const pilot: (r: Rover, i: Input | undefined, w: World) => boolean;
114
+ export declare const pilot: (r: Rover, i: Input | undefined, w: World, others?: readonly Body[], crash?: (jolt: number) => void) => boolean;
96
115
  /**
97
116
  * Where a shot from `o` along the unit `d` meets the hull within `m` metres: the distance, or
98
117
  * Infinity. The hull is the HITS spheres.
99
118
  */
100
119
  export declare const struck: (r: Rover, o: Vec3, d: Vec3, m: number) => number;
101
- /** The distance from `c` to the nearest point of the hull's spheres, 0 inside. */
120
+ /** The distance from `c` to the nearest point of the hull's spheres and the wings, 0 inside. */
102
121
  export declare const reach: (r: Rover, c: Vec3) => number;
103
122
  export {};
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.129.0",
5
+ "version": "0.130.1",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"