@korial29/tiny-fps 0.201.0 → 0.202.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/dist/server.js CHANGED
@@ -9540,6 +9540,8 @@ var Room = class {
9540
9540
  balls = [];
9541
9541
  /** Last tick a Hunter's shoulder laser hit, by player id. */
9542
9542
  hunterLasers = /* @__PURE__ */ new Map();
9543
+ /** Target and start tick of each Hunter's uninterrupted shoulder-laser lock. */
9544
+ hunterLocks = /* @__PURE__ */ new Map();
9543
9545
  /** The map's rovers, in the order of WorldDef.rovers, then its ships (ship.ts). */
9544
9546
  rovers = [];
9545
9547
  /** Collision geometry reused while a vehicle's pose is unchanged. */
@@ -9769,6 +9771,19 @@ var Room = class {
9769
9771
  const now = ++this.ticks;
9770
9772
  for (const p of players) p.bank = Math.min(10, p.bank + 1);
9771
9773
  this.think(players);
9774
+ for (const p of players) {
9775
+ if (!this.kit(p).hunter || p.state.down || !p.state.railed) {
9776
+ this.hunterLocks.delete(p.info.id);
9777
+ continue;
9778
+ }
9779
+ const target = this.shoulderTarget(p, void 0);
9780
+ const lock = this.hunterLocks.get(p.info.id);
9781
+ if (!target) this.hunterLocks.delete(p.info.id);
9782
+ else if (lock?.target !== target.id) this.hunterLocks.set(p.info.id, {
9783
+ target: target.id,
9784
+ since: now
9785
+ });
9786
+ }
9772
9787
  for (const b of this.balls) if (!b.burst && b.left > 0) this.fly(b, stepOf(b));
9773
9788
  this.heal(players);
9774
9789
  if (this.world.def.station && !this.ctf.over && this.station.tick() === "strike") this.strike(players);
@@ -10158,7 +10173,7 @@ var Room = class {
10158
10173
  if (by) by.state.hits = by.state.hits + 1 & 255;
10159
10174
  if (b.power === 6) this.shot(foe, BOLT_HP, by, b.dx, b.dz);
10160
10175
  else if (b.power === 8) this.shot(foe, 2, by, b.dx, b.dz, FRAG.GUN, b.back);
10161
- else if (b.power === 9) this.shot(foe, 2, by, b.dx, b.dz, FRAG.GUN, b.back);
10176
+ else if (b.power === 9) this.shot(foe, 3, by, b.dx, b.dz, FRAG.GUN, b.back);
10162
10177
  else if (b.power === 0) {
10163
10178
  foe.graze = ((foe.graze ?? 0) + 1) % 2;
10164
10179
  if (!foe.graze) this.shot(foe, 1, by, b.dx, b.dz, FRAG.GUN, b.back);
@@ -10344,8 +10359,8 @@ var Room = class {
10344
10359
  }
10345
10360
  }
10346
10361
  }
10347
- /** A lightly assisted shoulder shot: host-side target selection stays inside a narrow forward cone. */
10348
- shoulder(p, view) {
10362
+ /** The shoulder laser's assisted target, kept inside a narrow forward cone and clear line of sight. */
10363
+ shoulderTarget(p, view) {
10349
10364
  const foes = this.enemies(p, view);
10350
10365
  const origin = [
10351
10366
  p.state.x,
@@ -10374,7 +10389,18 @@ var Room = class {
10374
10389
  target = foe;
10375
10390
  }
10376
10391
  }
10377
- if (!target || this.ticks - (this.hunterLasers.get(p.info.id) ?? -Infinity) < 18) return;
10392
+ return target;
10393
+ }
10394
+ /** Fires only after an uninterrupted three-second target lock; damage is three HP. */
10395
+ shoulder(p, view) {
10396
+ const target = this.shoulderTarget(p, view);
10397
+ const lock = this.hunterLocks.get(p.info.id);
10398
+ if (!target || lock?.target !== target.id || this.ticks - lock.since < 180 || this.ticks - (this.hunterLasers.get(p.info.id) ?? -Infinity) < 18) return;
10399
+ const origin = [
10400
+ p.state.x,
10401
+ p.state.y + eyeHeight(p.state),
10402
+ p.state.z
10403
+ ];
10378
10404
  const delta = [
10379
10405
  target.x,
10380
10406
  target.y + eyeHeight(target) * .65,
@@ -10392,7 +10418,7 @@ var Room = class {
10392
10418
  this.hunterLasers.set(p.info.id, this.ticks);
10393
10419
  p.state.hits = p.state.hits + 1 & 255;
10394
10420
  const foe = this.players().find((q) => q.info.id === target.id);
10395
- if (foe) this.shot(foe, 1, p, aimed.d[0], aimed.d[2]);
10421
+ if (foe) this.shot(foe, 3, p, aimed.d[0], aimed.d[2]);
10396
10422
  }
10397
10423
  /** 1 hp of the bolt's drain to `foe`, as his railer deals it; if it puts him down he is disintegrated (`fried`). */
10398
10424
  fry(foe) {
@@ -51,7 +51,7 @@ export declare const db: (g: number) => number;
51
51
  */
52
52
  export declare const LEVELS: number[];
53
53
  export declare const LOUD: Record<number, number>;
54
- export declare const GROUP = "111111111155552022225522222222222222222233344333333333005533002200120120002000";
54
+ export declare const GROUP: string;
55
55
  /** Sets bus `i` to `db` live, and keeps the mix for the next visit; none, the mix as made. */
56
56
  export declare const mix: (i?: number, db?: number) => void;
57
57
  /**
@@ -20,7 +20,7 @@ export interface Balls {
20
20
  * The balls to draw at `now` (ms) and the places where one burst since the last frame. `muzzle`
21
21
  * gives the muzzle of a player's gun, where a new ball is first drawn.
22
22
  */
23
- frame(now: number, muzzle: (id: number) => Vec3 | undefined): {
23
+ frame(now: number, muzzle: (id: number) => Vec3 | undefined, discSound?: (kind: 'return' | 'catch', at: Vec3) => void): {
24
24
  orbs: Orb[];
25
25
  bursts: [Vec3, number, number?][];
26
26
  };
@@ -80,6 +80,8 @@ export interface Hud {
80
80
  mission(text?: string, hot?: boolean): void;
81
81
  /** The Hunter's current local vision mode. */
82
82
  hunterVision(text?: string): void;
83
+ /** The Predator-style shoulder-laser sight, at a screen point and progressing to a lock. */
84
+ hunterAim(at?: [number, number], progress?: number): void;
83
85
  /** The dark rim of a space helmet's visor around the screen: on while the own player wears one, off otherwise. */
84
86
  visor(on: boolean): void;
85
87
  /** The red vignette of a tackle, 0 (none) to 1 (full). */
@@ -1 +1,2 @@
1
1
  export declare function hunter(lod: 0 | 1 | 2): Record<string, number[]>;
2
+ export declare const hunterHarpoon: (lod: 0 | 1 | 2) => number[];
@@ -15,7 +15,7 @@ export declare const S: number, C: number;
15
15
  * rounded-square guard, a grip wrapped in a violet check and a pommel with a glowing bead.
16
16
  */
17
17
  export declare const katana: (lod: number) => number[];
18
- /** The Hunter's twin wrist blades and bracer, in the hand's local space. */
18
+ /** The Hunter's twin inward-curving wrist blades and forearm bracelet, in the hand's local space. */
19
19
  export declare const wristBlade: (lod: number) => number[];
20
20
  /** Places the wrist blade at the Hunter's right wrist. */
21
21
  export declare const heldWrist: (out: Out, pos: Vec3, q: Quat, lod: number, k?: number, list?: Pieces) => void;
@@ -151,6 +151,19 @@ export declare const SOUND: {
151
151
  readonly HUNTER_PAIN: 75;
152
152
  readonly HUNTER_DEATH: 76;
153
153
  readonly HUNTER_TAUNT: 77;
154
+ /** Original wrist-blade mechanisms: an upward deployment and a lower, locking retraction. */
155
+ readonly HUNTER_BLADE_DRAW: 78;
156
+ readonly HUNTER_BLADE_SHEATHE: 79;
157
+ /** The Hunter's paired blades: a rasping sweep and a bright metal impact. */
158
+ readonly HUNTER_BLADE_SWISH: 80;
159
+ readonly HUNTER_BLADE_HIT: 81;
160
+ /** A spinning disc launch, its return whistle, and the catch against the wrist bracer. */
161
+ readonly HUNTER_DISC_THROW: 82;
162
+ readonly HUNTER_DISC_RETURN: 83;
163
+ readonly HUNTER_DISC_CATCH: 84;
164
+ /** A rising three-step target lock and a heavy shoulder-mounted laser discharge. */
165
+ readonly HUNTER_LOCK: 85;
166
+ readonly HUNTER_LASER: 86;
154
167
  };
155
168
  /**
156
169
  * The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
@@ -371,8 +371,12 @@ export declare const DISK_RETURN = 10;
371
371
  export declare const DISK_SPEED = 52;
372
372
  export declare const DISK_RANGE = 28;
373
373
  export declare const DISK_R = 0.16;
374
- export declare const DISK_HP = 2;
374
+ export declare const DISK_HP = 3;
375
375
  export declare const DISK_COOL = 75;
376
+ /** Ticks a Hunter must keep a target in the shoulder laser's sight to lock on. */
377
+ export declare const HUNTER_LASER_LOCK: number;
378
+ /** Damage dealt by a locked Hunter shoulder laser. */
379
+ export declare const HUNTER_LASER_HP = 3;
376
380
  /** Ticks between assisted shoulder-laser hits. */
377
381
  export declare const HUNTER_LASER_COOL = 18;
378
382
  /** Plasma balls in flight in a room at most: past it the oldest bursts. They go on the wire. */
@@ -49,7 +49,7 @@ export interface Kit {
49
49
  * walls (MODE.CLING), a dash's burst that pins an enemy it reaches, acid for blood (room.ts).
50
50
  */
51
51
  xeno: boolean;
52
- /** The Hunter's class identity; its weapons and vision are introduced in later build steps. */
52
+ /** The Hunter's class identity, used for its weapons and alternate vision modes. */
53
53
  hunter?: boolean;
54
54
  }
55
55
  /** By ROLE. The astronaut moves and fights as the marine: the moon's gravity is the map's. */
@@ -23,6 +23,8 @@ export declare class Room {
23
23
  private balls;
24
24
  /** Last tick a Hunter's shoulder laser hit, by player id. */
25
25
  private hunterLasers;
26
+ /** Target and start tick of each Hunter's uninterrupted shoulder-laser lock. */
27
+ private hunterLocks;
26
28
  /** The map's rovers, in the order of WorldDef.rovers, then its ships (ship.ts). */
27
29
  private rovers;
28
30
  /** Collision geometry reused while a vehicle's pose is unchanged. */
@@ -192,7 +194,9 @@ export declare class Room {
192
194
  * and counts a hit. An enemy vehicle's hull is drained the same way, and shields who is behind it.
193
195
  */
194
196
  private rail;
195
- /** A lightly assisted shoulder shot: host-side target selection stays inside a narrow forward cone. */
197
+ /** The shoulder laser's assisted target, kept inside a narrow forward cone and clear line of sight. */
198
+ private shoulderTarget;
199
+ /** Fires only after an uninterrupted three-second target lock; damage is three HP. */
196
200
  private shoulder;
197
201
  /** 1 hp of the bolt's drain to `foe`, as his railer deals it; if it puts him down he is disintegrated (`fried`). */
198
202
  private fry;
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.201.0",
5
+ "version": "0.202.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"