@korial29/tiny-fps 0.184.0 → 0.185.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/index.js +34 -34
- package/dist/local.js +1 -1
- package/dist/server.js +16 -20
- package/dist/types/client/gloryfx.d.ts +29 -0
- package/dist/types/shared/constants.d.ts +8 -6
- package/dist/types/shared/room.d.ts +4 -3
- package/dist/types/shared/tackle.d.ts +3 -4
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -196,8 +196,9 @@ var [POUNCE_HP, POUNCE_STUN] = [2, 60];
|
|
|
196
196
|
/**
|
|
197
197
|
* The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
|
|
198
198
|
* flashes to one with the katana in hand, who beheads him on E within GLORY_REACH metres. The
|
|
199
|
-
* xenomorph's takes any enemy up, with no flash (the user, 2026-11-16): E within
|
|
200
|
-
* of him
|
|
199
|
+
* xenomorph's takes any enemy up, with no flash (the user, 2026-11-16): E within GLORY_REACH metres
|
|
200
|
+
* of him too (the user, 2026-11-17: only very close; 8 m before), in sight, and GLORY_ARC radians
|
|
201
|
+
* of its look locks the two (`lock`, `foe`, as a saber
|
|
201
202
|
* lock) for GLORY_TICKS, where he does not move and it dashes to him, then it eats his head: he
|
|
202
203
|
* goes down through his armour (LIMB.EATEN), a frag of FRAG.GLORY. 2 s, the time to see it climb
|
|
203
204
|
* on him and bite (the user, 2026-11-16: 0.9 s before).
|
|
@@ -209,12 +210,6 @@ var [GLORY_HP, GLORY_REACH, GLORY_ARC, GLORY_TICKS] = [
|
|
|
209
210
|
120
|
|
210
211
|
];
|
|
211
212
|
/**
|
|
212
|
-
* The xenomorph's glory kill from afar (the user, 2026-11-16): within GLORY_FAR metres, in sight,
|
|
213
|
-
* it dashes to a metre of its prey over the first GLORY_DASH ticks of the lock. 7 m in 20 ticks is
|
|
214
|
-
* 21 m/s, a step under PLAYER_R: it cannot tunnel.
|
|
215
|
-
*/
|
|
216
|
-
var [GLORY_FAR, GLORY_DASH] = [8, 20];
|
|
217
|
-
/**
|
|
218
213
|
* The katana's glory kill, an execution (room.ts feast(), the user 2026-11-17: 1.5 s, not at once):
|
|
219
214
|
* E locks the two for EXEC.TICKS (`exec` KILLER and VICTIM); the swordsman dashes in front of him,
|
|
220
215
|
* to EXEC.REACH metres, over GLORY_DASH ticks, cuts down (CUT.SLASH) at EXEC.CUTS[0] and drops him
|
|
@@ -6333,15 +6328,14 @@ var pouncing = (p) => p.dash > 50;
|
|
|
6333
6328
|
var reaches = (a, b) => Math.hypot(a.x - b.x, a.z - b.z) < 1.1 && a.y < b.y + heightOf(b) && b.y < a.y + heightOf(a);
|
|
6334
6329
|
/**
|
|
6335
6330
|
* The enemy `me` would glory kill with E (room.ts feast()), of `foes` as it sees them: the nearest
|
|
6336
|
-
* one up, in no lock and not seated, a body's height above or
|
|
6337
|
-
* the katana (`w` undefined)
|
|
6338
|
-
*
|
|
6339
|
-
* 2026-11-16).
|
|
6331
|
+
* one up, in no lock and not seated, within GLORY_REACH on the floor plane, a body's height above or
|
|
6332
|
+
* below and GLORY_ARC of its look. With the katana (`w` undefined) with GLORY_HP health or less; the
|
|
6333
|
+
* xenomorph's in sight through the world `w`, at any health (the user, 2026-11-16).
|
|
6340
6334
|
*/
|
|
6341
6335
|
var glory = (me, foes, w) => {
|
|
6342
6336
|
const [fx, fz] = forward(me.yaw);
|
|
6343
6337
|
let best;
|
|
6344
|
-
let near =
|
|
6338
|
+
let near = GLORY_REACH;
|
|
6345
6339
|
for (const f of foes) {
|
|
6346
6340
|
const [dx, dz] = [f.x - me.x, f.z - me.z];
|
|
6347
6341
|
const d = Math.hypot(dx, dz);
|
|
@@ -6427,10 +6421,10 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6427
6421
|
const locked = !down && (p.lock ?? 0) > 0;
|
|
6428
6422
|
const all = p.exec ? EXEC.TICKS : GLORY_TICKS;
|
|
6429
6423
|
const killer = !p.wield || p.exec === EXEC.KILLER;
|
|
6430
|
-
if (locked && killer && p.lock > all -
|
|
6424
|
+
if (locked && killer && p.lock > all - 20 && (p.vx || p.vz)) {
|
|
6431
6425
|
coast(p, w, bodies);
|
|
6432
6426
|
p.ev = p.lock == all ? EV.DASH : 0;
|
|
6433
|
-
if (p.lock <= all -
|
|
6427
|
+
if (p.lock <= all - 20 + 1) p.vx = p.vz = 0;
|
|
6434
6428
|
} else move(p, down || locked ? {
|
|
6435
6429
|
...i,
|
|
6436
6430
|
keys: 0
|
|
@@ -9516,8 +9510,8 @@ var Room = class {
|
|
|
9516
9510
|
/**
|
|
9517
9511
|
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up,
|
|
9518
9512
|
* within GLORY_ARC of its look where `p` drew him, and in no lock, is glory killed (glory()):
|
|
9519
|
-
* with the katana
|
|
9520
|
-
*
|
|
9513
|
+
* within GLORY_REACH, with the katana with GLORY_HP or less, the xenomorph's in sight, at any
|
|
9514
|
+
* health (the user, 2026-11-16). The two are locked (`lock`, `foe`),
|
|
9521
9515
|
* his flag dropped, `p` dashing in front of him: the xenomorph to a metre for GLORY_TICKS (the
|
|
9522
9516
|
* user, 2026-11-16), the swordsman to EXEC.REACH for an execution of EXEC.TICKS (`exec`, the user
|
|
9523
9517
|
* 2026-11-17: no longer at once); duel() ends it. True when it happened.
|
|
@@ -9568,7 +9562,7 @@ var Room = class {
|
|
|
9568
9562
|
});
|
|
9569
9563
|
a.state.exec = xeno ? 0 : exec;
|
|
9570
9564
|
}
|
|
9571
|
-
const v = Math.max(d - near, 0) * 60 /
|
|
9565
|
+
const v = Math.max(d - near, 0) * 60 / 20 / d;
|
|
9572
9566
|
[me.vx, me.vz] = [Math.fround(dx * v), Math.fround(dz * v)];
|
|
9573
9567
|
return true;
|
|
9574
9568
|
}
|
|
@@ -9598,6 +9592,7 @@ var Room = class {
|
|
|
9598
9592
|
const d = Math.hypot(dx, dz) || 1;
|
|
9599
9593
|
this.harm(prey, Infinity, eater, FRAG.GLORY, felled(FALL$1.STRUCK, dx / d, dz / d));
|
|
9600
9594
|
prey.state.lost = exec ? LIMB.HEAD : LIMB.EATEN;
|
|
9595
|
+
if (!exec) eater.state.hp = Math.min(eater.state.hp + 1, this.kit(eater).hp);
|
|
9601
9596
|
return;
|
|
9602
9597
|
}
|
|
9603
9598
|
const lead = (q.pushes ?? 0) - (o.state.pushes ?? 0);
|
|
@@ -9758,11 +9753,12 @@ var Room = class {
|
|
|
9758
9753
|
}
|
|
9759
9754
|
/**
|
|
9760
9755
|
* A press of USE on foot: the nearest rover within ROVER.ENTER_R on the floor plane with a seat
|
|
9761
|
-
* for him, the wheel first; a flag carrier only rides. Not while down, stumbling or in a lock
|
|
9756
|
+
* for him, the wheel first; a flag carrier only rides. Not while down, stumbling or in a lock, and
|
|
9757
|
+
* never the xenomorph (the user, 2026-11-17).
|
|
9762
9758
|
*/
|
|
9763
9759
|
enter(p) {
|
|
9764
9760
|
const q = p.state;
|
|
9765
|
-
if (q.down || q.stun || q.lock || q.mode === MODE.RIDE) return;
|
|
9761
|
+
if (q.down || q.stun || q.lock || q.mode === MODE.RIDE || this.kit(p).xeno) return;
|
|
9766
9762
|
const carrier = this.ctf.carrying(p.info.id) >= 0;
|
|
9767
9763
|
const r = this.rovers.filter((r) => nearby(r, q) && free(r, carrier) >= 0).sort((a, b) => gap2(a, q) - gap2(b, q))[0];
|
|
9768
9764
|
if (r) board(q, r, free(r, carrier));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PlayerState } from '../shared/types';
|
|
2
|
+
import type { Vec3 } from './mesh';
|
|
3
|
+
/**
|
|
4
|
+
* A cue: the tick of the lock it plays on, the sound, on the killer (0) or the victim (1), its gain
|
|
5
|
+
* and rate, and, to repeat it, every so many ticks up to a last; a victim's cue `voiced` is said in
|
|
6
|
+
* his own voice (its rate times voiceOf()).
|
|
7
|
+
*/
|
|
8
|
+
export type Cue = [
|
|
9
|
+
tick: number,
|
|
10
|
+
sound: number,
|
|
11
|
+
on: number,
|
|
12
|
+
gain: number,
|
|
13
|
+
rate: number,
|
|
14
|
+
every?: number,
|
|
15
|
+
last?: number,
|
|
16
|
+
voiced?: boolean
|
|
17
|
+
];
|
|
18
|
+
/** The xenomorph's, over GLORY_TICKS: on him at 18, its head back from 46, the bite home at 114. */
|
|
19
|
+
export declare const FEAST_CUES: Cue[];
|
|
20
|
+
/** The katana's, over EXEC.TICKS: the cut down bites at 36, he is on his knee at 46. */
|
|
21
|
+
export declare const EXEC_CUES: Cue[];
|
|
22
|
+
/** After the kill: seconds, then as a cue (on the place each stood). */
|
|
23
|
+
export declare const FEAST_AFTER: [number, number, number, number, number][];
|
|
24
|
+
export declare const EXEC_AFTER: [number, number, number, number, number][];
|
|
25
|
+
export interface GloryFx {
|
|
26
|
+
/** Plays what the glory kills of `players` (the own one among them) cue since the last frame. */
|
|
27
|
+
frame(players: PlayerState[]): void;
|
|
28
|
+
}
|
|
29
|
+
export declare const createGloryFx: (play: (id: number, at: Vec3, gain: number, rate: number) => void, voice: (id: number) => number, xeno: (id: number) => boolean, later?: (f: () => void, ms: number) => void) => GloryFx;
|
|
@@ -284,19 +284,21 @@ export declare const POUNCE_HP: number, POUNCE_STUN: number;
|
|
|
284
284
|
/**
|
|
285
285
|
* The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
|
|
286
286
|
* flashes to one with the katana in hand, who beheads him on E within GLORY_REACH metres. The
|
|
287
|
-
* xenomorph's takes any enemy up, with no flash (the user, 2026-11-16): E within
|
|
288
|
-
* of him
|
|
287
|
+
* xenomorph's takes any enemy up, with no flash (the user, 2026-11-16): E within GLORY_REACH metres
|
|
288
|
+
* of him too (the user, 2026-11-17: only very close; 8 m before), in sight, and GLORY_ARC radians
|
|
289
|
+
* of its look locks the two (`lock`, `foe`, as a saber
|
|
289
290
|
* lock) for GLORY_TICKS, where he does not move and it dashes to him, then it eats his head: he
|
|
290
291
|
* goes down through his armour (LIMB.EATEN), a frag of FRAG.GLORY. 2 s, the time to see it climb
|
|
291
292
|
* on him and bite (the user, 2026-11-16: 0.9 s before).
|
|
292
293
|
*/
|
|
293
294
|
export declare const GLORY_HP: number, GLORY_REACH: number, GLORY_ARC: number, GLORY_TICKS: number;
|
|
294
295
|
/**
|
|
295
|
-
* The
|
|
296
|
-
*
|
|
297
|
-
* 21 m/s, a step under PLAYER_R: it cannot tunnel.
|
|
296
|
+
* The ticks a glory kill's killer dashes to its prey over, at the start of the lock: the xenomorph
|
|
297
|
+
* to a metre of him, the swordsman to EXEC.REACH.
|
|
298
298
|
*/
|
|
299
|
-
export declare const
|
|
299
|
+
export declare const GLORY_DASH = 20;
|
|
300
|
+
/** The health the xenomorph gets back for a foe it ate (the user, 2026-11-17), up to XENO_HP. */
|
|
301
|
+
export declare const XENO_FEED = 1;
|
|
300
302
|
/**
|
|
301
303
|
* The katana's glory kill, an execution (room.ts feast(), the user 2026-11-17: 1.5 s, not at once):
|
|
302
304
|
* E locks the two for EXEC.TICKS (`exec` KILLER and VICTIM); the swordsman dashes in front of him,
|
|
@@ -187,8 +187,8 @@ export declare class Room {
|
|
|
187
187
|
/**
|
|
188
188
|
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up,
|
|
189
189
|
* within GLORY_ARC of its look where `p` drew him, and in no lock, is glory killed (glory()):
|
|
190
|
-
* with the katana
|
|
191
|
-
*
|
|
190
|
+
* within GLORY_REACH, with the katana with GLORY_HP or less, the xenomorph's in sight, at any
|
|
191
|
+
* health (the user, 2026-11-16). The two are locked (`lock`, `foe`),
|
|
192
192
|
* his flag dropped, `p` dashing in front of him: the xenomorph to a metre for GLORY_TICKS (the
|
|
193
193
|
* user, 2026-11-16), the swordsman to EXEC.REACH for an execution of EXEC.TICKS (`exec`, the user
|
|
194
194
|
* 2026-11-17: no longer at once); duel() ends it. True when it happened.
|
|
@@ -236,7 +236,8 @@ export declare class Room {
|
|
|
236
236
|
private seats;
|
|
237
237
|
/**
|
|
238
238
|
* A press of USE on foot: the nearest rover within ROVER.ENTER_R on the floor plane with a seat
|
|
239
|
-
* for him, the wheel first; a flag carrier only rides. Not while down, stumbling or in a lock
|
|
239
|
+
* for him, the wheel first; a flag carrier only rides. Not while down, stumbling or in a lock, and
|
|
240
|
+
* never the xenomorph (the user, 2026-11-17).
|
|
240
241
|
*/
|
|
241
242
|
private enter;
|
|
242
243
|
/**
|
|
@@ -14,9 +14,8 @@ export declare const pouncing: (p: PlayerState) => boolean;
|
|
|
14
14
|
export declare const reaches: (a: PlayerState, b: PlayerState) => boolean;
|
|
15
15
|
/**
|
|
16
16
|
* The enemy `me` would glory kill with E (room.ts feast()), of `foes` as it sees them: the nearest
|
|
17
|
-
* one up, in no lock and not seated, a body's height above or
|
|
18
|
-
* the katana (`w` undefined)
|
|
19
|
-
*
|
|
20
|
-
* 2026-11-16).
|
|
17
|
+
* one up, in no lock and not seated, within GLORY_REACH on the floor plane, a body's height above or
|
|
18
|
+
* below and GLORY_ARC of its look. With the katana (`w` undefined) with GLORY_HP health or less; the
|
|
19
|
+
* xenomorph's in sight through the world `w`, at any health (the user, 2026-11-16).
|
|
21
20
|
*/
|
|
22
21
|
export declare const glory: (me: PlayerState, foes: readonly PlayerState[], w?: World) => PlayerState | undefined;
|
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.185.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|