@korial29/tiny-fps 0.207.1 → 0.208.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/index.js +6 -6
- package/dist/local.js +1 -1
- package/dist/server.js +34 -17
- package/dist/types/client/audio.d.ts +2 -0
- package/dist/types/client/beams.d.ts +3 -1
- package/dist/types/client/body.d.ts +14 -16
- package/dist/types/client/hunter.d.ts +30 -0
- package/dist/types/client/render.d.ts +1 -1
- package/dist/types/client/xeno.d.ts +5 -2
- package/dist/types/shared/blade.d.ts +2 -1
- package/dist/types/shared/constants.d.ts +6 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -183,6 +183,12 @@ var TAILS = [
|
|
|
183
183
|
knock: 0
|
|
184
184
|
}
|
|
185
185
|
];
|
|
186
|
+
/**
|
|
187
|
+
* The tail's charged release (the user, 2026-11-23: let go, it goes far at full power): no slower
|
|
188
|
+
* than a tap but TAIL_FAST times its time from the top, and TAIL_FAR metres further, where the
|
|
189
|
+
* katana's heavy release is HEAVY times as slow and HEAVY_REACH further (swingOf()).
|
|
190
|
+
*/
|
|
191
|
+
var [TAIL_FAST, TAIL_FAR] = [.75, 1];
|
|
186
192
|
var [PUNCH_HITS, PUNCH_STUN, PUNCH_MEMORY] = [
|
|
187
193
|
2,
|
|
188
194
|
3,
|
|
@@ -1980,15 +1986,18 @@ var cutOf = (keys, thrust = true) => {
|
|
|
1980
1986
|
/**
|
|
1981
1987
|
* The swing `p` is in, its numbers as CUTS has them (`table`; the xenomorph's is TAILS): the cut's
|
|
1982
1988
|
* own, or, for a heavy release (`heavy`), the rest of it from the top of its wind-up, HEAVY times as
|
|
1983
|
-
* slow, with its own timer from there, and harder and wider.
|
|
1989
|
+
* slow, with its own timer from there, and harder and wider. The tail's (TAILS) is fast and long
|
|
1990
|
+
* instead: TAIL_FAST times its time, TAIL_FAR metres further.
|
|
1984
1991
|
*/
|
|
1985
1992
|
var swingOf = (p, table = CUTS) => {
|
|
1986
1993
|
const c = table[p.cut ?? 0];
|
|
1994
|
+
const tail = table === TAILS;
|
|
1995
|
+
const k = tail ? TAIL_FAST : HEAVY;
|
|
1987
1996
|
return p.heavy ? {
|
|
1988
1997
|
...c,
|
|
1989
|
-
ticks: Math.round((c.ticks - c.hold) *
|
|
1990
|
-
strike: Math.round((c.strike - c.hold) *
|
|
1991
|
-
reach: c.reach + HEAVY_REACH,
|
|
1998
|
+
ticks: Math.round((c.ticks - c.hold) * k),
|
|
1999
|
+
strike: Math.round((c.strike - c.hold) * k),
|
|
2000
|
+
reach: c.reach + (tail ? TAIL_FAR : HEAVY_REACH),
|
|
1992
2001
|
arc: c.arc * HEAVY_ARC,
|
|
1993
2002
|
hp: c.hp + HEAVY_HP
|
|
1994
2003
|
} : c;
|
|
@@ -5981,7 +5990,10 @@ var launch$1 = (p, team = 0, harpoon = false) => {
|
|
|
5981
5990
|
};
|
|
5982
5991
|
/** The Hunter's returning disc: a wide, fast shot that the room turns back toward its owner. */
|
|
5983
5992
|
var disk = (p, team = 0) => ({
|
|
5984
|
-
...launch$1(
|
|
5993
|
+
...launch$1({
|
|
5994
|
+
...p,
|
|
5995
|
+
rifled: false
|
|
5996
|
+
}, team),
|
|
5985
5997
|
power: 9,
|
|
5986
5998
|
left: 28
|
|
5987
5999
|
});
|
|
@@ -6878,12 +6890,16 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6878
6890
|
0
|
|
6879
6891
|
];
|
|
6880
6892
|
const own = kit.hunter;
|
|
6881
|
-
if (own)
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6893
|
+
if (own) {
|
|
6894
|
+
[p.rail, p.cap, p.rifle, p.clip, p.nades] = [
|
|
6895
|
+
0,
|
|
6896
|
+
0,
|
|
6897
|
+
0,
|
|
6898
|
+
0,
|
|
6899
|
+
0
|
|
6900
|
+
];
|
|
6901
|
+
if (p.ammo < 0 && !p.down) [p.ammo, p.mag] = [kit.ammo, kit.mag];
|
|
6902
|
+
}
|
|
6887
6903
|
if (armed && gear && inside && !p.rack) [p.ammo, p.mag] = [kit.ammo, kit.mag];
|
|
6888
6904
|
p.rack = inside;
|
|
6889
6905
|
p.blade = !!kit.katana || !!p.blade || armed && gear && !!blade && within(p, blade, 1.2);
|
|
@@ -6920,7 +6936,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6920
6936
|
p.swing = swingOf(p, table).ticks;
|
|
6921
6937
|
} else if (kit.xeno && top && free && !holding && (p.charge ?? 0) > 0) {
|
|
6922
6938
|
p.charge = 0;
|
|
6923
|
-
p.swing = ticks - 1;
|
|
6939
|
+
p.swing = ticks - hold - 1;
|
|
6924
6940
|
} else {
|
|
6925
6941
|
p.charge = top || kit.xeno && !p.heavy ? 0 : p.charge;
|
|
6926
6942
|
const s = p.swing ?? 0;
|
|
@@ -7010,11 +7026,6 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
7010
7026
|
p.shots = p.shots + 1 & 255;
|
|
7011
7027
|
return STRIKE.NADE;
|
|
7012
7028
|
}
|
|
7013
|
-
if (kit.hunter && p.wield && i.keys & KEY.SPECIAL && !(i.keys & KEY.FIRE) && !busy && !p.swing && !p.cool) {
|
|
7014
|
-
p.cool = 75;
|
|
7015
|
-
p.shots = p.shots + 1 & 255;
|
|
7016
|
-
return STRIKE.DISK;
|
|
7017
|
-
}
|
|
7018
7029
|
if (p.wield && i.keys & KEY.SPECIAL && !busy && !p.swing) {
|
|
7019
7030
|
p.cut = i.keys & KEY.FIRE ? cutOf(i.keys, !kit.hunter) + 4 : (i.keys & (KEY.LEFT | KEY.RIGHT)) === KEY.LEFT ? CUT.ARC_L : CUT.ARC_R;
|
|
7020
7031
|
[p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
|
|
@@ -7034,6 +7045,12 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
7034
7045
|
p.cut = cutOf(i.keys, !kit.hunter);
|
|
7035
7046
|
[p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
|
|
7036
7047
|
launch(p);
|
|
7048
|
+
} else if (p.rifled && own) {
|
|
7049
|
+
if (!p.cool) {
|
|
7050
|
+
p.cool = 75;
|
|
7051
|
+
p.shots = p.shots + 1 & 255;
|
|
7052
|
+
return STRIKE.DISK;
|
|
7053
|
+
}
|
|
7037
7054
|
} else if (p.rifled) {
|
|
7038
7055
|
if (!p.cool && p.clip && !p.reload) {
|
|
7039
7056
|
p.rifle--;
|
|
@@ -33,6 +33,8 @@ export interface Audio {
|
|
|
33
33
|
speak(id: number, at?: Vec3, db?: number, rate?: number, radio?: boolean): boolean;
|
|
34
34
|
/** The sound `id` (one of LOOPED) as a loop, silent until its first set; the own player's, centred. */
|
|
35
35
|
loop(id: number): Loop;
|
|
36
|
+
/** Fades the music out (true) or back in (false), the other sounds untouched: the Hunter's visions. */
|
|
37
|
+
hush(on: boolean): void;
|
|
36
38
|
/** Mutes or unmutes everything, music included. */
|
|
37
39
|
mute(on: boolean): void;
|
|
38
40
|
readonly muted: boolean;
|
|
@@ -29,7 +29,7 @@ export interface Tracer {
|
|
|
29
29
|
a: Vec3;
|
|
30
30
|
b: Vec3;
|
|
31
31
|
}[]): void;
|
|
32
|
-
/** The Hunter's shoulder cannon's shot from `a` to `b`: a
|
|
32
|
+
/** The Hunter's shoulder cannon's shot from `a` to `b`: a red ball like the pistol's flying there, bursting at `b`. */
|
|
33
33
|
laser(a: Vec3, b: Vec3): void;
|
|
34
34
|
/** A ball burst at `at`: a splash of light and a spray of sparks; a laser rifle's, `red`, bigger and fiercer. */
|
|
35
35
|
burst(at: Vec3, red?: boolean): void;
|
|
@@ -63,6 +63,8 @@ export interface Tracer {
|
|
|
63
63
|
mount(a: Vec3): void;
|
|
64
64
|
/** Ages everything by dt seconds and drops what is over. */
|
|
65
65
|
update(dt: number): void;
|
|
66
|
+
/** Appends the thrown discs' metal, lit and casting shadows like the bodies: before draw()'s glow. */
|
|
67
|
+
solids(out: Out): void;
|
|
66
68
|
/** Appends the balls, the flashes, the bolts and the sparks, turned to the camera at `eye`. */
|
|
67
69
|
draw(out: Out, eye: Vec3): void;
|
|
68
70
|
/** The lights of the flashes, the splashes, the bolts and the nearest balls, for gather(). */
|
|
@@ -120,22 +120,12 @@ export declare const counter: (p: Pick<PlayerState, "cut">, prog: number) => [nu
|
|
|
120
120
|
type Claws = boolean | 'short';
|
|
121
121
|
/** The ring of a finger from which on it is bare: the glove's fingers end 60 % along the middle phalanx. */
|
|
122
122
|
export declare const BARE = 8;
|
|
123
|
-
/**
|
|
124
|
-
* The rings of a finger, in the hand's space: from `p` along `d1`, `d2` then `d3`, its three
|
|
125
|
-
* phalanges (BONES of `l`), `r` thick at the root, the first ring across `t`. Each bend is a curve
|
|
126
|
-
* through the joint, not a corner, so that a fist keeps a round knuckle. The glove ends at ring
|
|
127
|
-
* BARE in a rolled edge; the skin goes on to the tip.
|
|
128
|
-
*/
|
|
129
123
|
export declare const finger: (p: Vec3, d1: Vec3, d2: Vec3, d3: Vec3, l: number, r: number, t: Vec3,
|
|
130
124
|
/** 0 to 1: a skeleton's finger (the xenomorph's), thin bones between swollen knuckles, a fine tip. */
|
|
131
|
-
bony?: number
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
* fingers from the wrist and 2.2 cm toward the palm, their tips back at the heel of the palm (the
|
|
136
|
-
* user, 2026-11-09: the fingers stood off the katana's grip).
|
|
137
|
-
*/
|
|
138
|
-
export declare const phalanges: (curl: number, i: number) => [Vec3, Vec3, Vec3];
|
|
125
|
+
bony?: number,
|
|
126
|
+
/** How far each joint's curve reaches along the bones, a share of them: less, a sharper joint. */
|
|
127
|
+
knee?: number) => Ring[];
|
|
128
|
+
export declare const phalanges: (curl: number, i: number, spread?: number, hook?: number) => [Vec3, Vec3, Vec3];
|
|
139
129
|
/** The strap round the wrist (the user, 2026-11-14: finer): its width, and how far it stands out of the palm's ring. */
|
|
140
130
|
export declare const STRAP: {
|
|
141
131
|
w: number;
|
|
@@ -162,7 +152,11 @@ lights?: boolean,
|
|
|
162
152
|
/** The xenomorph's claws on the fingertips (Grip). */
|
|
163
153
|
claws?: Claws,
|
|
164
154
|
/** Its size: the xenomorph's grows from the wrist over 4 cm, hers is smaller (hands()). */
|
|
165
|
-
grow?: number
|
|
155
|
+
grow?: number,
|
|
156
|
+
/** How far the fingers fan out, times an open hand's (phalanges()). */
|
|
157
|
+
spread?: number,
|
|
158
|
+
/** How far the fingers' last bones bend further, radians (phalanges()). */
|
|
159
|
+
hook?: number) => void;
|
|
166
160
|
/** What a hand does besides closing (hand()): the left index pointing, the right thumb pushing toward `to`, the left thumb cupped. */
|
|
167
161
|
export interface Grip {
|
|
168
162
|
point?: number;
|
|
@@ -173,6 +167,10 @@ export interface Grip {
|
|
|
173
167
|
lights?: boolean;
|
|
174
168
|
/** The xenomorph's: a hooked claw of bone on each fingertip, for the nail. */
|
|
175
169
|
claws?: Claws;
|
|
170
|
+
/** The right hand's fingers fanned out this many times an open hand's (the Hunter's disc). */
|
|
171
|
+
spread?: number;
|
|
172
|
+
/** The right hand's fingers' last bones bent further, radians: gripping an edge. */
|
|
173
|
+
hook?: number;
|
|
176
174
|
}
|
|
177
175
|
/**
|
|
178
176
|
* Both hands of the skeleton `s` on its wrists, left then right, each closed `curls[i]` (hand()), in
|
|
@@ -180,7 +178,7 @@ export interface Grip {
|
|
|
180
178
|
* body and the runners share it, so a runner's fist closes on a grip as the own one does. `lite` is
|
|
181
179
|
* a near runner's hand, `skip` a hand not drawn (the one a cut took off with its arm).
|
|
182
180
|
*/
|
|
183
|
-
export declare const hands: (out: Out, s: Solved, build: number, curls: number[], glove: number[], bare: number[], { point, push, to, cup, lights, claws }?: Grip, lite?: boolean, skip?: number) => void;
|
|
181
|
+
export declare const hands: (out: Out, s: Solved, build: number, curls: number[], glove: number[], bare: number[], { point, push, to, cup, lights, claws, spread, hook, }?: Grip, lite?: boolean, skip?: number) => void;
|
|
184
182
|
/** On a wall run the rail gun is put away, unless its bolt is going out. */
|
|
185
183
|
export declare const stowed: (p: PlayerState) => boolean;
|
|
186
184
|
/**
|
|
@@ -66,6 +66,8 @@ export interface HunterPiece {
|
|
|
66
66
|
harpoon: boolean;
|
|
67
67
|
/** The shoulder cannon, from its hinge (CANNON_HINGE) rather than the joint: it folds about it. */
|
|
68
68
|
cannon: boolean;
|
|
69
|
+
/** The disc on his hip, left out while it is in his hand. */
|
|
70
|
+
disc: boolean;
|
|
69
71
|
vertices: number[];
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
@@ -102,3 +104,31 @@ export declare const hunterPose: (pos: Vec3[], rot: [number, number, number, num
|
|
|
102
104
|
* rotations: each vertex placed by both bones and mixed by its share, its normal likewise.
|
|
103
105
|
*/
|
|
104
106
|
export declare const blendHunter: (out: Out, band: HunterBand, joints: Vec3[], rot: [number, number, number, number][]) => void;
|
|
107
|
+
/** The thrown disc and the disc in hand, times the hip's (the user, 2026-11-23: bigger). */
|
|
108
|
+
export declare const DISC_SCALE = 1.5;
|
|
109
|
+
/**
|
|
110
|
+
* The hip's throwing disc (the model's 'Flying disc' without its belt clip) in its own frame: the
|
|
111
|
+
* hub at the origin, the disc in the x-y plane and its face along +z, DISC_SCALE times as big. The thrown disc and the disc
|
|
112
|
+
* in hand are drawn with it (the user, 2026-11-23: the armour's disc).
|
|
113
|
+
*/
|
|
114
|
+
export declare const discVertices: (lod: 0 | 1 | 2) => number[];
|
|
115
|
+
/**
|
|
116
|
+
* The disc's hub from the hand's grip (gun.ts grip()), metres: forward along the fingers, and down
|
|
117
|
+
* under the palm (against gun.ts axes()' right, the back of the hand).
|
|
118
|
+
*/
|
|
119
|
+
export declare const DISC_HOLD: readonly [number, number];
|
|
120
|
+
/** The own hand holding the disc, moved from the gun's place in camera space (right, up, ahead), metres. */
|
|
121
|
+
export declare const DISC_RAISE: Vec3;
|
|
122
|
+
/** The own hand holding the disc: how far its fingers lean ahead of straight up (a slope). */
|
|
123
|
+
export declare const DISC_TILT = 2;
|
|
124
|
+
/** The fingers on the disc fanned out this many times an open hand's (the user, 2026-11-23). */
|
|
125
|
+
export declare const DISC_SPREAD = 5.5;
|
|
126
|
+
/** How far the fingers bend over the disc's edge in all, radians, over their three joints (the user, 2026-11-23). */
|
|
127
|
+
export declare const DISC_HOOK = 1.4;
|
|
128
|
+
/** How far the fingers close over the disc (hand()'s curl): little, long over its hub (the user, 2026-11-23). */
|
|
129
|
+
export declare const DISC_CURL = 0.05;
|
|
130
|
+
/**
|
|
131
|
+
* The armour's disc in a hand (the user, 2026-11-23: the disc in hand is the one on his hip):
|
|
132
|
+
* centred `at`, its plane along `x` and `y` and its face along `n`, all unit.
|
|
133
|
+
*/
|
|
134
|
+
export declare const drawDisc: (out: Out, at: Vec3, x: Vec3, y: Vec3, n: Vec3, lod?: 0 | 1 | 2) => void;
|
|
@@ -184,7 +184,7 @@ export interface Renderer {
|
|
|
184
184
|
/** The xenomorph's vision (the own player is one): a grey-blue world, the enemies in sight glowing. */
|
|
185
185
|
vision(on: boolean): void;
|
|
186
186
|
/** The Hunter's local vision filter and the players it can detect. */
|
|
187
|
-
hunterVision(mode: number, targets: PlayerState[]): void;
|
|
187
|
+
hunterVision(mode: number, targets: PlayerState[], cold?: PlayerState[]): void;
|
|
188
188
|
/** Let eligible glory kill targets flash during play. */
|
|
189
189
|
edge(on: boolean): void;
|
|
190
190
|
/** The body of each player (PlayerInfo.body, BODY), from the roster: the man's for one not in it; and the skin and haircut he picked, his id's for one not in `looks`. */
|
|
@@ -21,7 +21,9 @@ export declare const TAIL: {
|
|
|
21
21
|
* forward down into the view), its turn about the pelvis' up (radians, to its left: through its
|
|
22
22
|
* right side, a tail pointing back turns forward), its lean to the right, its reach (as a share of
|
|
23
23
|
* its length, a whip stretched), how much of the hook at its tip it keeps, how far its root
|
|
24
|
-
* rises, how far it coils in an S,
|
|
24
|
+
* rises, how far it coils in an S, how strongly its stinger follows the aim, and how far its tip
|
|
25
|
+
* is drawn onto the foe ahead of the eyes (tail(), the user 2026-11-23: in the own view the strike
|
|
26
|
+
* lands on the crosshair).
|
|
25
27
|
*/
|
|
26
28
|
export type Lash = readonly [
|
|
27
29
|
sting: number,
|
|
@@ -31,7 +33,8 @@ export type Lash = readonly [
|
|
|
31
33
|
hook: number,
|
|
32
34
|
rise: number,
|
|
33
35
|
coil?: number,
|
|
34
|
-
aim?: number
|
|
36
|
+
aim?: number,
|
|
37
|
+
pull?: number
|
|
35
38
|
];
|
|
36
39
|
/** At rest: behind, hooked. */
|
|
37
40
|
export declare const HOOKED: Lash;
|
|
@@ -21,7 +21,8 @@ export declare const cutOf: (keys: number, thrust?: boolean) => number;
|
|
|
21
21
|
/**
|
|
22
22
|
* The swing `p` is in, its numbers as CUTS has them (`table`; the xenomorph's is TAILS): the cut's
|
|
23
23
|
* own, or, for a heavy release (`heavy`), the rest of it from the top of its wind-up, HEAVY times as
|
|
24
|
-
* slow, with its own timer from there, and harder and wider.
|
|
24
|
+
* slow, with its own timer from there, and harder and wider. The tail's (TAILS) is fast and long
|
|
25
|
+
* instead: TAIL_FAST times its time, TAIL_FAR metres further.
|
|
25
26
|
*/
|
|
26
27
|
export declare const swingOf: (p: Pick<PlayerState, "cut" | "heavy">, table?: typeof CUTS) => {
|
|
27
28
|
ticks: number;
|
|
@@ -261,6 +261,12 @@ export declare const TAILS: {
|
|
|
261
261
|
knock: number;
|
|
262
262
|
}[];
|
|
263
263
|
export declare const TAIL_LEAP = 10;
|
|
264
|
+
/**
|
|
265
|
+
* The tail's charged release (the user, 2026-11-23: let go, it goes far at full power): no slower
|
|
266
|
+
* than a tap but TAIL_FAST times its time from the top, and TAIL_FAR metres further, where the
|
|
267
|
+
* katana's heavy release is HEAVY times as slow and HEAVY_REACH further (swingOf()).
|
|
268
|
+
*/
|
|
269
|
+
export declare const TAIL_FAST: number, TAIL_FAR: number;
|
|
264
270
|
export declare const PUNCH_HITS: number, PUNCH_STUN: number, PUNCH_MEMORY: number;
|
|
265
271
|
/**
|
|
266
272
|
* The xenomorph (the user, 2026-11-15; kit.ts). XENO_HP health. It clings to a wall it faces with
|
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.208.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|