@korial29/tiny-fps 0.56.0 → 0.56.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.
@@ -1,8 +1,9 @@
1
1
  import type { Ball, PlayerState } from './types';
2
2
  import type { World } from './world';
3
3
  type Vec3 = [number, number, number];
4
- /** Metres a ball flies in a tick. */
4
+ /** Metres a ball flies in a tick, and an arc. */
5
5
  export declare const PLASMA_STEP: number;
6
+ export declare const ARC_STEP: number;
6
7
  /** Ticks of the shooter's lag a new ball is flown at most on the host before its first tick. */
7
8
  export declare const PLASMA_LAG = 12;
8
9
  /** A ball the host flies: whose team fired it, and the metres it has left. */
@@ -16,6 +17,14 @@ export interface Flying extends Ball {
16
17
  * as the shot (`power`).
17
18
  */
18
19
  export declare const launch: (p: PlayerState, team?: number) => Flying;
20
+ /**
21
+ * The arc of energy the ARC cut of `p` throws at its strike (`p` the state after that step): from
22
+ * the eye along the look like a ball, ARC_RANGE metres to go, its CUT in `arc`. Its id is the
23
+ * `shots` count with the top bit turned, apart from his balls' (one arc is gone before the next).
24
+ */
25
+ export declare const wave: (p: PlayerState, team?: number) => Flying;
26
+ /** Metres the flight `b` goes in a tick. */
27
+ export declare const stepOf: (b: Ball) => number;
19
28
  /**
20
29
  * Distance at which the ray from `o` along the unit `d` enters the upright cylinder of radius `r`
21
30
  * on `c`'s feet, `h` tall; Infinity on a miss.
@@ -23,8 +32,8 @@ export declare const launch: (p: PlayerState, team?: number) => Flying;
23
32
  export declare const cylinder: (o: Vec3, d: Vec3, c: PlayerState, r: number, h: number) => number;
24
33
  /**
25
34
  * Flies `b` on by `m` metres (at most what it has left) as a sphere of PLASMA_R: it stops and
26
- * bursts on the first brush, or on the first of `foes` whose body (a cylinder PLASMA_R wider) it
27
- * enters. Returns the foe it burst on.
35
+ * bursts on the first brush, or on the first of `foes` whose body (a cylinder PLASMA_R wider, ARC_R
36
+ * for an arc) it enters. Returns the foe it burst on.
28
37
  */
29
38
  export declare const fly: (w: World, b: Flying, m: number, foes: PlayerState[]) => PlayerState | undefined;
30
39
  export {};
@@ -68,12 +68,16 @@ export declare class Room {
68
68
  */
69
69
  private harm;
70
70
  /**
71
- * A shot of `p` went off at the view tick `view`: its ball starts where `p` saw it start, flown
72
- * on by his lag (the view tick to now, at most PLASMA_LAG ticks) against the others as they are
73
- * now. Past PLASMA_MAX balls in flight, the oldest bursts.
71
+ * A shot of `p` went off at the view tick `view`: its ball (or the arc `b` of an ARC cut) starts
72
+ * where `p` saw it start, flown on by his lag (the view tick to now, at most PLASMA_LAG ticks)
73
+ * against the others as they are now. Past PLASMA_MAX balls in flight, the oldest bursts.
74
74
  */
75
75
  private shoot;
76
- /** Flies the ball `b` on by `m` metres: one that bursts on an enemy who is up takes its power in hp from him, and counts a hit to its shooter. */
76
+ /**
77
+ * Flies the ball `b` on by `m` metres: one that bursts on an enemy who is up takes its power in hp
78
+ * from him, and counts a hit to its shooter. An arc takes its cut's hp; one it does not put down
79
+ * is floored (FLOOR_TICKS, `zap`), thrown ARC_KNOCK m/s the way it flies, and drops the flag.
80
+ */
77
81
  private fly;
78
82
  /**
79
83
  * A cut of `p` struck at the view tick `view`: every enemy it reaches as `p` drew him is hit
@@ -56,8 +56,9 @@ export declare const KEY: {
56
56
  * The katana's cuts (PlayerState.cut, constants CUTS), chosen by the keys held when FIRE starts
57
57
  * one: LEFT or RIGHT (one of them) cuts across from that side, else FORWARD thrusts, else (back or
58
58
  * no key) it slashes down from above. With SPECIAL (a double click) each has its special, the cut
59
- * plus SPECIAL_CUT: the thrust a LUNGE (a dash forward on the point), a cut across a SPIN (a full
60
- * turn on himself, the blade out all round), the slash a LEAP (a jump and a blow down on landing).
59
+ * plus SPECIAL_CUT: the thrust a LUNGE (a dash forward on the point), a cut across an ARC (a heavy
60
+ * cut down across the body that throws an arc of energy ahead, see wave(), plasma.ts), the slash a
61
+ * LEAP (a jump and a blow down on landing).
61
62
  */
62
63
  export declare const CUT: {
63
64
  readonly THRUST: 0;
@@ -65,8 +66,8 @@ export declare const CUT: {
65
66
  readonly RIGHT: 2;
66
67
  readonly SLASH: 3;
67
68
  readonly LUNGE: 4;
68
- readonly SPIN_L: 5;
69
- readonly SPIN_R: 6;
69
+ readonly ARC_L: 5;
70
+ readonly ARC_R: 6;
70
71
  readonly LEAP: 7;
71
72
  };
72
73
  /** A cut plus this is its special; a cut's base cut is the cut less it. */
@@ -303,6 +304,8 @@ export interface Ball {
303
304
  burst: boolean;
304
305
  /** Its strength, 1 to CHARGE_MAX: the health it takes. Absent reads 1. */
305
306
  power?: number;
307
+ /** An arc of energy, not a ball: the CUT that threw it (ARC_L or ARC_R). Absent for a ball. */
308
+ arc?: number;
306
309
  }
307
310
  /** The flag of a team as a snapshot carries it: only the fields of its state are meaningful, the rest read 0. */
308
311
  export interface FlagState {
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.56.0",
5
+ "version": "0.56.2",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"