@korial29/tiny-fps 0.191.1 → 0.191.2
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 +1 -1
- package/dist/local.js +1 -1
- package/dist/server.js +14 -10
- package/dist/types/client/input.d.ts +7 -6
- package/dist/types/shared/gun.d.ts +2 -2
- package/dist/types/shared/types.d.ts +4 -4
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -594,9 +594,9 @@ var KEY = {
|
|
|
594
594
|
*/
|
|
595
595
|
BLADE: 512,
|
|
596
596
|
/**
|
|
597
|
-
* Set
|
|
598
|
-
* of the cut the keys give (see CUT)
|
|
599
|
-
*
|
|
597
|
+
* Set for one step by G or the right button (the client's choice): with the katana in hand, the
|
|
598
|
+
* special of the cut the keys give (see CUT); with the laser rifle in hand, a grenade from its
|
|
599
|
+
* launcher. Ignored with the other guns.
|
|
600
600
|
*/
|
|
601
601
|
SPECIAL: 1024,
|
|
602
602
|
/**
|
|
@@ -614,7 +614,7 @@ var KEY = {
|
|
|
614
614
|
/**
|
|
615
615
|
* The katana's cuts (PlayerState.cut, constants CUTS), chosen by the keys held when FIRE starts
|
|
616
616
|
* one: LEFT or RIGHT (one of them) cuts across from that side, else FORWARD thrusts, else (back or
|
|
617
|
-
* no key) it slashes down from above. With SPECIAL (
|
|
617
|
+
* no key) it slashes down from above. With SPECIAL (G or the right button) each has its special, the cut
|
|
618
618
|
* plus SPECIAL_CUT: the thrust a LUNGE (a dash forward on the point), a cut across an ARC (a heavy
|
|
619
619
|
* cut down across the body that throws an arc of energy ahead, see wave(), plasma.ts), the slash a
|
|
620
620
|
* LEAP (a jump and a blow down on landing).
|
|
@@ -6419,8 +6419,8 @@ var STRIKE = {
|
|
|
6419
6419
|
* letting it go fires a ball as strong as the charge (powerOf()), spending as many shots; or it
|
|
6420
6420
|
* starts the katana's swing (`cut` from the keys), unless the hands are busy (a hang, a climb).
|
|
6421
6421
|
* The katana in hand, busy hands or no shot left drop the charge.
|
|
6422
|
-
*
|
|
6423
|
-
*
|
|
6422
|
+
* SPECIAL (G or the right button) with the katana in hand and no swing starts the special of
|
|
6423
|
+
* that cut instead, FIRE or not. The cut strikes `CUTS[cut].strike` ticks into
|
|
6424
6424
|
* its swing. The look is the input's, so both go where the player sees.
|
|
6425
6425
|
* `armed` is false while the match is over: no weapon, no rack. `bodies` are move()'s.
|
|
6426
6426
|
*/
|
|
@@ -6557,9 +6557,13 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6557
6557
|
p.shots = p.shots + 1 & 255;
|
|
6558
6558
|
return STRIKE.NADE;
|
|
6559
6559
|
}
|
|
6560
|
+
if (p.wield && i.keys & KEY.SPECIAL && !busy && !p.swing) {
|
|
6561
|
+
p.cut = cutOf(i.keys) + 4;
|
|
6562
|
+
[p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
|
|
6563
|
+
launch(p);
|
|
6564
|
+
return STRIKE.NONE;
|
|
6565
|
+
}
|
|
6560
6566
|
if (i.keys & KEY.FIRE && !busy) {
|
|
6561
|
-
const late = CUTS[p.cut ?? 0].ticks - (p.swing ?? 0);
|
|
6562
|
-
const special = !!(i.keys & KEY.SPECIAL) && (!p.swing || !p.heavy && (p.cut ?? 0) < 4 && late <= 18);
|
|
6563
6567
|
if (bare) {
|
|
6564
6568
|
if (!p.swing) {
|
|
6565
6569
|
p.cut = tackling(p) || p.mode === MODE.GROUND && !!(i.keys & KEY.SPRINT) && p.vx * p.vx + p.vz * p.vz > kit.run * kit.run ? BLOW.LUNGE : BLOW.JAB;
|
|
@@ -6568,8 +6572,8 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6568
6572
|
p.cut++;
|
|
6569
6573
|
p.swing = PUNCHES[p.cut].ticks;
|
|
6570
6574
|
}
|
|
6571
|
-
} else if (p.wield &&
|
|
6572
|
-
p.cut = cutOf(i.keys)
|
|
6575
|
+
} else if (p.wield && !p.swing) {
|
|
6576
|
+
p.cut = cutOf(i.keys);
|
|
6573
6577
|
[p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
|
|
6574
6578
|
launch(p);
|
|
6575
6579
|
} else if (p.rifled) {
|
|
@@ -7,7 +7,7 @@ export declare const DOUBLE_TAP_MS = 250;
|
|
|
7
7
|
export declare const dashKeys: (keys: number, dir: number) => number;
|
|
8
8
|
/** The KEY bit of a KeyboardEvent.code, 0 for a key the game ignores. */
|
|
9
9
|
export declare const keyBit: (code: string) => number;
|
|
10
|
-
/** A second
|
|
10
|
+
/** A second right press (or G) within this of the first (ms) is a double click: the xenomorph's tail special. */
|
|
11
11
|
export declare const DOUBLE_CLICK_MS = 300;
|
|
12
12
|
/** The wheel swaps the weapon at most this often (ms): a trackpad's flick is a hundred events, one swap. */
|
|
13
13
|
export declare const WHEEL_MS = 250;
|
|
@@ -42,7 +42,7 @@ export interface Controls {
|
|
|
42
42
|
keys: number;
|
|
43
43
|
/** The chosen weapon (WEAPON: 1, 2, 3 and the wheel). */
|
|
44
44
|
weapon: number;
|
|
45
|
-
/** At a ship's stick (the client sets it): a press of G is a missile whatever the weapon
|
|
45
|
+
/** At a ship's stick (the client sets it): a press of G or of the right button is a missile whatever the weapon. */
|
|
46
46
|
pilot: boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Playing the xenomorph (the client sets it): the right button strikes with the tail as FIRE cuts
|
|
@@ -54,8 +54,9 @@ export interface Controls {
|
|
|
54
54
|
* The KEY bits of the next step, read once per step. Same as `keys`, plus BLADE while the katana
|
|
55
55
|
* is chosen and RAIL while the rail gun is, except for the step right after a double tap: it carries DASH and only the tapped
|
|
56
56
|
* direction, so the dash goes that way whatever else is held, and nothing else is on the wire.
|
|
57
|
-
* The step after a
|
|
58
|
-
*
|
|
57
|
+
* The step after a press of G or of the right button carries SPECIAL: the katana's special cut
|
|
58
|
+
* with it in hand, a grenade with the rifle, a missile at a ship's stick (step() ignores it with
|
|
59
|
+
* the other guns).
|
|
59
60
|
*/
|
|
60
61
|
take(): number;
|
|
61
62
|
/** One live step of the own player, its state before and after: a katana or a rail gun picked up is chosen, losing every weapon chooses the gun. */
|
|
@@ -68,8 +69,8 @@ export interface Controls {
|
|
|
68
69
|
/**
|
|
69
70
|
* Click the canvas to lock the pointer; while locked the mouse looks, the keys move (WASD, Shift
|
|
70
71
|
* sprints, Space jumps, Q dashes, C crouches, E gets in and out of a rover, a direction key pressed twice within DOUBLE_TAP_MS dashes that
|
|
71
|
-
* way, the left button fires or cuts
|
|
72
|
-
* rifle, 1, 2 and 3 or the wheel pick
|
|
72
|
+
* way, the left button fires or cuts, G or the right button cuts the katana's special or launches a
|
|
73
|
+
* grenade with the rifle, 1, 2 and 3 or the wheel pick
|
|
73
74
|
* the gun, the katana or the rail gun) and M calls `onMute`.
|
|
74
75
|
*/
|
|
75
76
|
export declare const createInput: (canvas: HTMLCanvasElement, onMute?: () => void) => Controls;
|
|
@@ -42,8 +42,8 @@ export type Strike = (typeof STRIKE)[keyof typeof STRIKE];
|
|
|
42
42
|
* letting it go fires a ball as strong as the charge (powerOf()), spending as many shots; or it
|
|
43
43
|
* starts the katana's swing (`cut` from the keys), unless the hands are busy (a hang, a climb).
|
|
44
44
|
* The katana in hand, busy hands or no shot left drop the charge.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* SPECIAL (G or the right button) with the katana in hand and no swing starts the special of
|
|
46
|
+
* that cut instead, FIRE or not. The cut strikes `CUTS[cut].strike` ticks into
|
|
47
47
|
* its swing. The look is the input's, so both go where the player sees.
|
|
48
48
|
* `armed` is false while the match is over: no weapon, no rack. `bodies` are move()'s.
|
|
49
49
|
*/
|
|
@@ -58,9 +58,9 @@ export declare const KEY: {
|
|
|
58
58
|
*/
|
|
59
59
|
readonly BLADE: 512;
|
|
60
60
|
/**
|
|
61
|
-
* Set
|
|
62
|
-
* of the cut the keys give (see CUT)
|
|
63
|
-
*
|
|
61
|
+
* Set for one step by G or the right button (the client's choice): with the katana in hand, the
|
|
62
|
+
* special of the cut the keys give (see CUT); with the laser rifle in hand, a grenade from its
|
|
63
|
+
* launcher. Ignored with the other guns.
|
|
64
64
|
*/
|
|
65
65
|
readonly SPECIAL: 1024;
|
|
66
66
|
/**
|
|
@@ -78,7 +78,7 @@ export declare const KEY: {
|
|
|
78
78
|
/**
|
|
79
79
|
* The katana's cuts (PlayerState.cut, constants CUTS), chosen by the keys held when FIRE starts
|
|
80
80
|
* one: LEFT or RIGHT (one of them) cuts across from that side, else FORWARD thrusts, else (back or
|
|
81
|
-
* no key) it slashes down from above. With SPECIAL (
|
|
81
|
+
* no key) it slashes down from above. With SPECIAL (G or the right button) each has its special, the cut
|
|
82
82
|
* plus SPECIAL_CUT: the thrust a LUNGE (a dash forward on the point), a cut across an ARC (a heavy
|
|
83
83
|
* cut down across the body that throws an arc of energy ahead, see wave(), plasma.ts), the slash a
|
|
84
84
|
* LEAP (a jump and a blow down on landing).
|
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.191.
|
|
5
|
+
"version": "0.191.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|