@korial29/tiny-fps 0.104.1 → 0.105.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 +15 -15
- package/dist/local.js +1 -1
- package/dist/server.js +122 -10
- package/dist/types/client/beams.d.ts +4 -0
- package/dist/types/client/combat.d.ts +1 -1
- package/dist/types/client/effects.d.ts +2 -0
- package/dist/types/client/gun.d.ts +2 -0
- package/dist/types/client/hud.d.ts +3 -2
- package/dist/types/shared/constants.d.ts +19 -0
- package/dist/types/shared/gun.d.ts +5 -2
- package/dist/types/shared/physics.d.ts +2 -0
- package/dist/types/shared/plasma.d.ts +22 -0
- package/dist/types/shared/protocol.d.ts +1 -1
- package/dist/types/shared/room.d.ts +5 -1
- package/dist/types/shared/types.d.ts +9 -2
- package/package.json +1 -1
|
@@ -4,13 +4,14 @@ import type { World } from './world';
|
|
|
4
4
|
type Vec3 = [number, number, number];
|
|
5
5
|
/** Whether the feet of `p` are within `r` of the point `at` on the floor plane and within PICK_H of its height. */
|
|
6
6
|
export declare const within: (p: PlayerState, at: Vec3, r: number) => boolean;
|
|
7
|
-
/** What a step struck, for the host to resolve: nothing, a shot (a plasma ball), the katana's cut, a rail gun's beam,
|
|
7
|
+
/** What a step struck, for the host to resolve: nothing, a shot (a plasma ball), the katana's cut, a rail gun's beam, a laser rifle's shot, or a grenade from its launcher. */
|
|
8
8
|
export declare const STRIKE: {
|
|
9
9
|
readonly NONE: 0;
|
|
10
10
|
readonly SHOT: 1;
|
|
11
11
|
readonly CUT: 2;
|
|
12
12
|
readonly RAIL: 3;
|
|
13
13
|
readonly LASER: 4;
|
|
14
|
+
readonly NADE: 5;
|
|
14
15
|
};
|
|
15
16
|
export type Strike = (typeof STRIKE)[keyof typeof STRIKE];
|
|
16
17
|
/**
|
|
@@ -31,7 +32,9 @@ export type Strike = (typeof STRIKE)[keyof typeof STRIKE];
|
|
|
31
32
|
* - The rail gun throws its bolt on every step FIRE is held, spending a tick of it (`zapping`),
|
|
32
33
|
* unless it is `hot`: its `heat` rises while it fires and falls when it does not (HEAT_MAX).
|
|
33
34
|
* - The laser rifle (KEY.RIFLE, `rifled`), filled at its rack on arrival, fires a round from its
|
|
34
|
-
* cell (`clip`) each RIFLE_COOL ticks while FIRE is held (STRIKE.LASER).
|
|
35
|
+
* cell (`clip`) each RIFLE_COOL ticks while FIRE is held (STRIKE.LASER). Its rack loads NADE_MAX
|
|
36
|
+
* grenades too: SPECIAL (a double click) launches one (STRIKE.NADE) when `lob` is 0, even during
|
|
37
|
+
* a swap of the cell, then `lob` runs NADE_COOL ticks and the rifle holds its fire NADE_HOLD.
|
|
35
38
|
* - The trigger: `cool` and `swing` run down, and at 0 a held FIRE charges the gun, with ammo, and
|
|
36
39
|
* letting it go fires a ball as strong as the charge (powerOf()), spending as many shots; or it
|
|
37
40
|
* starts the katana's swing (`cut` from the keys), unless the hands are busy (a hang, a climb).
|
|
@@ -39,4 +39,26 @@ export declare const cylinder: (o: Vec3, d: Vec3, c: PlayerState, r: number, h:
|
|
|
39
39
|
* for an arc) it enters. Returns the foe it burst on.
|
|
40
40
|
*/
|
|
41
41
|
export declare const fly: (w: World, b: Flying, m: number, foes: PlayerState[]) => PlayerState | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The grenade `p` has just launched (`p` the state after that step): from the eye along the look,
|
|
44
|
+
* with no drift, at NADE_SPEED, NADE_RANGE metres of flight to go. Named by his `shots` like a ball.
|
|
45
|
+
*/
|
|
46
|
+
export declare const lob: (p: PlayerState, team?: number) => Flying;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the shot `p` has just fired (a change of `shots`) was a grenade: the rifle holds its
|
|
49
|
+
* fire NADE_HOLD ticks after one, so nothing else of his counts in them.
|
|
50
|
+
*/
|
|
51
|
+
export declare const lobbed: (p: PlayerState) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* One tick of the grenade `b`: the map's gravity bends its flight, then it flies on as a ball
|
|
54
|
+
* (fly()) and bursts on the first brush or foe, or at the end of its range. Float32, so the
|
|
55
|
+
* shooter's client flies the same one.
|
|
56
|
+
*/
|
|
57
|
+
export declare const toss: (w: World, b: Flying, foes: PlayerState[]) => PlayerState | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* The health a grenade bursting at `c` takes from `p`: NADE_HP at the body, less with the distance
|
|
60
|
+
* to its nearest point (the axis, feet to head), nothing from NADE_R on, rounded up. Nothing when
|
|
61
|
+
* a brush hides both that point and the chest.
|
|
62
|
+
*/
|
|
63
|
+
export declare const blast: (w: World, c: Vec3, p: PlayerState) => number;
|
|
42
64
|
export {};
|
|
@@ -40,7 +40,7 @@ export declare const MSG_INPUT = 1;
|
|
|
40
40
|
export declare const MSG_SNAPSHOT = 2;
|
|
41
41
|
export declare const INPUT_BYTES = 12;
|
|
42
42
|
export declare const SNAP_HEAD = 4;
|
|
43
|
-
export declare const SNAP_PLAYER =
|
|
43
|
+
export declare const SNAP_PLAYER = 62;
|
|
44
44
|
/** Bytes of a rover: thirteen float32 and the two seats. */
|
|
45
45
|
export declare const SNAP_ROVER = 54;
|
|
46
46
|
/** The rover count has three bits of the head's count byte, the players the other five. */
|
|
@@ -86,13 +86,17 @@ export declare class Room {
|
|
|
86
86
|
/**
|
|
87
87
|
* A shot of `p` went off at the view tick `view`: its ball (or the arc `b` of an ARC cut) starts
|
|
88
88
|
* where `p` saw it start, flown on by his lag (the view tick to now, at most PLASMA_LAG ticks)
|
|
89
|
-
* against the others as they are now. Past PLASMA_MAX balls in flight, the oldest bursts.
|
|
89
|
+
* against the others as they are now. Past PLASMA_MAX balls in flight, the oldest bursts. A
|
|
90
|
+
* grenade (lob()) is flown on the same way, a tick of its arc at a time.
|
|
90
91
|
*/
|
|
91
92
|
private shoot;
|
|
92
93
|
/**
|
|
93
94
|
* Flies the ball `b` on by `m` metres: one that bursts on an enemy who is up takes its power in hp
|
|
94
95
|
* from him, and counts a hit to its shooter. An arc takes its cut's hp; one it does not put down
|
|
95
96
|
* is floored (FLOOR_TICKS, `zap`), thrown ARC_KNOCK m/s the way it flies, and drops the flag.
|
|
97
|
+
* A grenade flies one tick of its arc whatever `m`, and its burst is a blast: every enemy who is
|
|
98
|
+
* up, and its owner, lose what blast() gives where they stand now; one hit for the shooter when
|
|
99
|
+
* it hurt an enemy.
|
|
96
100
|
*/
|
|
97
101
|
private fly;
|
|
98
102
|
/**
|
|
@@ -39,7 +39,8 @@ export declare const KEY: {
|
|
|
39
39
|
readonly BLADE: 512;
|
|
40
40
|
/**
|
|
41
41
|
* Set with FIRE by a double click (the client's choice): the katana's special cut, the special
|
|
42
|
-
* of the cut the keys give (see CUT)
|
|
42
|
+
* of the cut the keys give (see CUT); with the laser rifle in hand, a grenade from its launcher.
|
|
43
|
+
* Ignored with the other guns.
|
|
43
44
|
*/
|
|
44
45
|
readonly SPECIAL: 1024;
|
|
45
46
|
/**
|
|
@@ -205,6 +206,10 @@ export interface PlayerState {
|
|
|
205
206
|
rifle?: number;
|
|
206
207
|
/** Rounds in the laser rifle's power cell, of `rifle` (RIFLE_CLIP at most). Absent reads 0. */
|
|
207
208
|
clip?: number;
|
|
209
|
+
/** Grenades left in the laser rifle's launcher (NADE_MAX at its rack, none without the rifle). Absent reads 0. */
|
|
210
|
+
nades?: number;
|
|
211
|
+
/** Ticks before the launcher fires again (NADE_COOL after a grenade). Absent reads 0. */
|
|
212
|
+
lob?: number;
|
|
208
213
|
/** The laser rifle is in hand (see KEY.RIFLE). Absent reads false. */
|
|
209
214
|
rifled?: boolean;
|
|
210
215
|
/** Standing inside the circle of the team's rifle rack as of the last step. Absent reads false. */
|
|
@@ -311,8 +316,10 @@ export interface Ball {
|
|
|
311
316
|
dz: number;
|
|
312
317
|
/** It burst where it is: the last snapshot that carries it. */
|
|
313
318
|
burst: boolean;
|
|
314
|
-
/** Its strength, 1 to CHARGE_MAX: the health it takes. Absent reads 1. */
|
|
319
|
+
/** Its strength, 1 to CHARGE_MAX: the health it takes. Absent reads 1. 0 is a laser rifle's, BOLT a rover's, NADE a grenade. */
|
|
315
320
|
power?: number;
|
|
321
|
+
/** A grenade's speed along its direction, m/s (the wire keeps whole m/s, 63 at most). Absent for the rest. */
|
|
322
|
+
v?: number;
|
|
316
323
|
/** An arc of energy, not a ball: the CUT that threw it (ARC_L or ARC_R). Absent for a ball. */
|
|
317
324
|
arc?: number;
|
|
318
325
|
}
|
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.105.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|