@korial29/tiny-fps 0.101.0 → 0.102.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.
@@ -1,3 +1,4 @@
1
+ import type { Body } from './physics';
1
2
  import type { Flying } from './plasma';
2
3
  import type { Input, PlayerState, Rover } from './types';
3
4
  import type { World } from './world';
@@ -50,6 +51,8 @@ export declare const ROVER: {
50
51
  readonly BODY: readonly [1.15, 0, -1.15];
51
52
  readonly BODY_H: 1.5;
52
53
  readonly WHEEL_STEP: 0.6;
54
+ /** The share of its speed into another rover a rover bounces back with. */
55
+ readonly BOUNCE: 0.3;
53
56
  /** A player this close to a rover's centre gets in; a rover this fast hurts an enemy, and this fast puts him down. */
54
57
  readonly ENTER_R: 3;
55
58
  readonly SPLAT_MIN: 6;
@@ -72,12 +75,18 @@ export declare const wheels: (r: Rover, w: World) => [...Vec3, c: number][];
72
75
  * the nose, front first, each at the height of its bottom, BODY_H under its top.
73
76
  */
74
77
  export declare const footprint: (r: Rover) => Vec3[];
78
+ /**
79
+ * The body as the players on foot and the other rovers meet it: the stadium round the front and
80
+ * rear circles of footprint(), RB wide and BODY_H tall. A player walks into it and stands on it.
81
+ */
82
+ export declare const hull: (r: Rover) => Body;
75
83
  /** The map's rovers at rest on their spawns, nobody aboard. */
76
84
  export declare const park: (w: World) => Rover[];
77
85
  /**
78
86
  * One step of 1 / TICK_HZ s, in place. `i` is the driver's input as the wire rounds it (FORWARD and
79
87
  * BACK the throttle, JUMP the handbrake, its yaw where the nose is steered to), or undefined with
80
- * nobody at the wheel: the brake is on. Reads only the rover, the input and the world. Returns
88
+ * nobody at the wheel: the brake is on. Reads only the rover, the input, the world and the
89
+ * `fleet` (the map's rovers, itself skipped: walls it stops on, BOUNCE back, never pushed). Returns
81
90
  * whether it fell under the world's kill floor: the caller parks it again.
82
91
  *
83
92
  * The body is a point with a pitch and a roll on four springs. Each wheel reads the floor under
@@ -86,7 +95,7 @@ export declare const park: (w: World) => Rover[];
86
95
  * turns toward the look as fast as the speed allows, and the tyres' grip decides how much of the
87
96
  * speed follows it. The rest drifts.
88
97
  */
89
- export declare const drive: (r: Rover, i: Input | undefined, w: World) => boolean;
98
+ export declare const drive: (r: Rover, i: Input | undefined, w: World, fleet?: readonly Rover[]) => boolean;
90
99
  /**
91
100
  * Puts the body of a player on seat `s` (0 the driver's, 1 the rider's) of the rover, with its
92
101
  * speed. The seat leans with the body: on a slope he is not left in the air.
@@ -108,8 +117,9 @@ export declare const leave: (p: PlayerState, r: Rover, s: 0 | 1, w: World) => vo
108
117
  * The driver's whole step, on the host and in the predictor alike: the rover is driven by his
109
118
  * input, he follows on his seat, and a press of USE gets him out. Returns drive()'s answer. A step
110
119
  * that takes him off his seat (move() puts a body under the kill floor back at a spawn) frees it.
120
+ * `fleet` is drive()'s.
111
121
  */
112
- export declare const ride: (p: PlayerState, r: Rover, i: Input, w: World, team: number) => boolean;
122
+ export declare const ride: (p: PlayerState, r: Rover, i: Input, w: World, team: number, fleet?: readonly Rover[]) => boolean;
113
123
  /** Where the rover's lasers cross: GUN_AIM metres from its centre along the driver's look. */
114
124
  export declare const aimOf: (r: Rover, yaw: number, pitch: number) => [number, number, number];
115
125
  /**
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.101.0",
5
+ "version": "0.102.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"