@korial29/tiny-fps 1.9.1 → 1.10.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.
package/dist/room.js CHANGED
@@ -1 +1 @@
1
- export { n as MAPS, r as RULES, t as Room } from "./assets/room-DNdwMAUE.js";
1
+ export { n as MAPS, r as RULES, t as Room } from "./assets/room-BPH05sFp.js";
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Room } from "./assets/room-DNdwMAUE.js";
1
+ import { t as Room } from "./assets/room-BPH05sFp.js";
2
2
  import { WebSocketServer } from "ws";
3
3
  // src/server/index.ts
4
4
  /** `/demo` → "demo", `/` → "default". Undecodable paths are kept as is. */
@@ -2,7 +2,7 @@ import type { Vec3 } from './nav';
2
2
  import type { Flying } from './plasma';
3
3
  import type { Errand } from './sortie';
4
4
  import type { Kit } from './kit';
5
- import type { FlagState, PlayerState } from './types';
5
+ import type { FlagState, PlayerState, Rover } from './types';
6
6
  import type { World } from './world';
7
7
  /** A player as a bot sees him: the host's own state, no rewind. */
8
8
  export interface Seen {
@@ -22,6 +22,8 @@ export interface Sight {
22
22
  balls?: readonly Flying[];
23
23
  /** What the room asks of it at the orbital station (sortie.ts). */
24
24
  errand?: Errand;
25
+ /** The free rover within its walk, or the one it drives (valet.ts). */
26
+ car?: Rover;
25
27
  /** The numbers of its class (kit.ts): the marine's when absent. */
26
28
  kit?: Kit;
27
29
  /** Its team's roles this tick, worked out once by the room (squad()); else its own reckoning. */
@@ -78,6 +80,8 @@ export interface Persona {
78
80
  lead: number;
79
81
  /** The share of a target's change of speed it catches up with a tick. */
80
82
  track: number;
83
+ /** The share of the cars within its walk that it takes on a long way (valet.ts). */
84
+ ride: number;
81
85
  }
82
86
  /** The character of the bot `id` in a room of this skill. */
83
87
  export declare const personaOf: (id: number, skill?: number) => Persona;
@@ -160,6 +164,9 @@ export declare class Bot {
160
164
  private weighed;
161
165
  /** Its errand to the orbital station, when it has one. */
162
166
  private sortie;
167
+ /** Its rides in a rover, and whether it was at the wheel last tick. */
168
+ private valet;
169
+ private riding;
163
170
  /**
164
171
  * Whether it jumps unlike the marine the routes were flown with (the ninja, the xenomorph): it
165
172
  * steers every leap in the air to come down on its point, as the moon's (`land`).
@@ -194,6 +201,11 @@ export declare class Bot {
194
201
  private goalOf;
195
202
  /** The guard's point: round its flag, a stop at each point, one way or the other by its id. */
196
203
  private patrol;
204
+ /**
205
+ * Its rides (valet.ts): to a free rover on a long way, at its wheel along its own way, out where
206
+ * the way turns to a leg. None when it is on foot and goes its way.
207
+ */
208
+ private ride;
197
209
  private urgent;
198
210
  private plan;
199
211
  /**
@@ -67,6 +67,8 @@ export declare class Ctf {
67
67
  frag(id: number): number;
68
68
  /** The room is empty: the next match starts from scratch. */
69
69
  reset(): void;
70
+ /** Ticks the match has run (it counts down from the time limit). */
71
+ elapsed(): number;
70
72
  /** The part of a snapshot that is the match's. */
71
73
  wire(): Pick<Snapshot, 'score' | 'clock' | 'over' | 'flags'>;
72
74
  /**
@@ -354,6 +354,11 @@ export declare class Room {
354
354
  * errand goes home.
355
355
  */
356
356
  private errands;
357
+ /**
358
+ * The rover a bot may drive: the one at whose wheel it sits, or the nearest empty one within its
359
+ * walk (valet.ts), never a ship (the station's errand flies those).
360
+ */
361
+ private carOf;
357
362
  /** The bots' map of the world, built when it loads rather than in the tick of a bot's first plan. */
358
363
  private guide;
359
364
  /** The players the bots fill the room up to: none with no human. */
@@ -0,0 +1,54 @@
1
+ import type { PlayerState, Rover } from './types';
2
+ import type { World } from './world';
3
+ type Vec3 = [number, number, number];
4
+ export type Intent = {
5
+ keys: number;
6
+ yaw: number;
7
+ pitch: number;
8
+ };
9
+ /** The ride's numbers: metres. */
10
+ export declare const RIDE: {
11
+ /** The shortest way worth a car, and the farthest car it walks to. */
12
+ LONG: number;
13
+ NEAR: number;
14
+ /** The point of its way it steers for is at least this far ahead; it gets out this close to the end of the way. */
15
+ LOOK: number;
16
+ END: number;
17
+ /** Metres ahead it looks for a drop, and the fall that stops it. */
18
+ AHEAD: number;
19
+ DROP: number;
20
+ /** Ticks it walks to a car before it gives up, drives at the longest, and stands still before it gets out. */
21
+ WALK: number;
22
+ DRIVE: number;
23
+ STUCK: number;
24
+ /** Ticks before it thinks of a car again after it got out or gave up. */
25
+ PAUSE: number;
26
+ };
27
+ /** The bot's memory of a ride. */
28
+ export declare class Valet {
29
+ /** Where it walks to on the ground to board, for its own way finding; none when it is not boarding. */
30
+ board: Vec3 | undefined;
31
+ private since;
32
+ private idle;
33
+ private index;
34
+ private asleep;
35
+ private walked;
36
+ /**
37
+ * Whether it wants this car now, on foot: it has a long way to go, the car is close and free, and
38
+ * it is of a driving mind this once (`take` the share of the cars it takes, `rnd` its dice).
39
+ * Decided once a PAUSE, then kept for the walk to the car.
40
+ */
41
+ wants(p: PlayerState, car: Rover | undefined, goal: Vec3, t: number, take: number, rnd: () => number): boolean;
42
+ /** On foot toward the car `car`: walks to it, then presses USE beside it. */
43
+ approach(p: PlayerState, car: Rover, t: number): Intent | undefined;
44
+ /** Called when it sits at the wheel: the ride begins. */
45
+ start(t: number): void;
46
+ /**
47
+ * One tick at the wheel of `car` on its `way` (the points of its path before the first leg; the
48
+ * goal when none): the keys and look, or a press of USE to get out.
49
+ */
50
+ drive(car: Rover, way: readonly Vec3[], w: World, t: number): Intent;
51
+ }
52
+ /** Whether `p` is seated at the wheel of `car`. */
53
+ export declare const driver: (p: PlayerState, car: Rover | undefined, id: number) => car is Rover;
54
+ 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": "1.9.1",
5
+ "version": "1.10.1",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"