@korial29/tiny-fps 0.100.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.
- package/README.md +1 -1
- package/dist/index.js +22 -14
- package/dist/local.js +1 -1
- package/dist/server.js +120 -28
- package/dist/types/client/hud.d.ts +2 -0
- package/dist/types/client/render.d.ts +1 -0
- package/dist/types/shared/gun.d.ts +3 -2
- package/dist/types/shared/physics.d.ts +16 -2
- package/dist/types/shared/rover.d.ts +15 -3
- package/package.json +1 -1
|
@@ -68,6 +68,19 @@ export declare const speedOf: (p: Pick<PlayerState, "vx" | "vz">) => number;
|
|
|
68
68
|
export declare const sprinting: (p: Pick<PlayerState, "mode" | "vx" | "vz">) => boolean;
|
|
69
69
|
/** push() for a circle of radius r: a rover's body is a few of them. */
|
|
70
70
|
export declare const shove: (p: Pos, w: World, h: number, r: number) => [x: number, z: number];
|
|
71
|
+
/**
|
|
72
|
+
* A solid that moves, which the players walk into and stand on: a rover's body (hull(), rover.ts).
|
|
73
|
+
* The stadium of radius r round the segment a to b on the floor plane, from the height of the
|
|
74
|
+
* segment (between those of a and b) up h.
|
|
75
|
+
*/
|
|
76
|
+
export interface Body {
|
|
77
|
+
a: [x: number, y: number, z: number];
|
|
78
|
+
b: [x: number, y: number, z: number];
|
|
79
|
+
r: number;
|
|
80
|
+
h: number;
|
|
81
|
+
}
|
|
82
|
+
/** The offset from the closest point of a body's axis to (x, z), and the height of its bottom there. */
|
|
83
|
+
export declare const gapTo: (o: Body, x: number, z: number) => [dx: number, dz: number, y: number];
|
|
71
84
|
/**
|
|
72
85
|
* The highest floor under the point (x, z) at most as high as y: the ground of the relief, or the
|
|
73
86
|
* top of a brush the point is over. For a rover's wheel.
|
|
@@ -87,7 +100,8 @@ export declare const stumble: (p: PlayerState, dx: number, dz: number, ticks?: n
|
|
|
87
100
|
/**
|
|
88
101
|
* Applies one input for 1 / TICK_HZ s, in place: yaw and pitch from the input (pitch clamped to
|
|
89
102
|
* MAX_PITCH), then the step of the current mode (see the top of the file). Feet under the world's
|
|
90
|
-
* kill floor put the player back at a spawn of his `team` (EV.RESPAWN).
|
|
103
|
+
* kill floor put the player back at a spawn of his `team` (EV.RESPAWN). `bodies` are the rovers'
|
|
104
|
+
* (hull(), rover.ts) as they stand when the step runs: walls and floors for this step alone.
|
|
91
105
|
*/
|
|
92
|
-
export declare const move: (p: PlayerState, i: Input, w: World, team?: number) => void;
|
|
106
|
+
export declare const move: (p: PlayerState, i: Input, w: World, team?: number, bodies?: readonly Body[]) => void;
|
|
93
107
|
export {};
|
|
@@ -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
|
|
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,11 @@ 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;
|
|
123
|
+
/** Where the rover's lasers cross: GUN_AIM metres from its centre along the driver's look. */
|
|
124
|
+
export declare const aimOf: (r: Rover, yaw: number, pitch: number) => [number, number, number];
|
|
113
125
|
/**
|
|
114
126
|
* The two bolts of one salvo of the rover's lasers, left then right: each from its muzzle toward
|
|
115
127
|
* the point GUN_AIM metres along the driver's look (the yaw and pitch of his input) from the rover's
|
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.
|
|
5
|
+
"version": "0.102.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|