@korial29/tiny-fps 0.196.0 → 0.196.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.
@@ -24,6 +24,8 @@ export interface Sight {
24
24
  errand?: Errand;
25
25
  /** The numbers of its class (kit.ts): the marine's when absent. */
26
26
  kit?: Kit;
27
+ /** Its team's roles this tick, worked out once by the room (squad()); else its own reckoning. */
28
+ squad?: Squad;
27
29
  /** The health packs there now, not taken. */
28
30
  packs?: readonly Vec3[];
29
31
  /** The bots that shot to hit each enemy last tick, by the enemy's id (Bot.hunting): TOKENS of them hit, the others miss. */
@@ -81,6 +83,11 @@ export interface Persona {
81
83
  export declare const personaOf: (id: number, skill?: number) => Persona;
82
84
  /** What a bot of a team does, handed out by squad(). */
83
85
  type Role = 'chase' | 'return' | 'escort' | 'help' | 'guard' | 'attack';
86
+ /** A team's roles by bot id, and the teammate the 'help' goes to. */
87
+ export type Squad = {
88
+ roles: Map<number, Role>;
89
+ trouble?: Seen;
90
+ };
84
91
  /**
85
92
  * The roles of a team's bots this tick, the same in every bot's head (they see the same team):
86
93
  * the nearest to each job takes it, the most pressing jobs first. Half the team or more chase the
@@ -88,10 +95,7 @@ type Role = 'chase' | 'return' | 'escort' | 'help' | 'guard' | 'attack';
88
95
  * home), one or two return a lying flag, two escort the carrier, one goes to a teammate an enemy
89
96
  * is on while he is low, one guards home in a squad of three or more, and the rest attack.
90
97
  */
91
- export declare const squad: (team: number, players: readonly Seen[], flags: readonly FlagState[], world: World) => {
92
- roles: Map<number, Role>;
93
- trouble?: Seen;
94
- };
98
+ export declare const squad: (team: number, players: readonly Seen[], flags: readonly FlagState[], world: World) => Squad;
95
99
  export declare class Bot {
96
100
  readonly id: number;
97
101
  /** The route it prefers, an index of nav.ts's ROUTES. */
@@ -121,6 +125,12 @@ export declare class Bot {
121
125
  private shot;
122
126
  private warned;
123
127
  private past;
128
+ /** A guard's flag and round, the point it goes to, the tick it leaves it, and where it looks there. */
129
+ private base;
130
+ private posts;
131
+ private post;
132
+ private stop;
133
+ private gaze;
124
134
  /** The tick it last fought each enemy, by id. */
125
135
  private met;
126
136
  /** The enemy it shot to hit this tick, -1 for none: the room hands it to the others as `hunters`. */
@@ -176,6 +186,8 @@ export declare class Bot {
176
186
  private evade;
177
187
  /** Where it wants to be. */
178
188
  private goalOf;
189
+ /** The guard's point: round its flag, a stop at each point, one way or the other by its id. */
190
+ private patrol;
179
191
  private plan;
180
192
  /**
181
193
  * The keys and yaw of the move, whether the bot may look away from it to shoot, and whether the
@@ -234,7 +234,7 @@ export declare const PUNCHES: {
234
234
  * the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()), and the strike takes
235
235
  * more the longer it charged (TAIL_HP, sting()). A double click of the right button (KEY.SPECIAL
236
236
  * with it) is its special: a sweep's is the SPIN, the tail whipped all round the body; the stab's
237
- * and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it lands; each takes its own
237
+ * and the lash's the LEAP, up TAIL_LEAP m/s once released and down on the foe; each takes its own
238
238
  * `hp`. The xenomorph's `cut` reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
239
239
  */
240
240
  /**
@@ -419,8 +419,6 @@ export declare const HEAVY_HP: number, HEAVY_REACH: number, HEAVY_ARC: number;
419
419
  */
420
420
  export declare const ARC_SPEED: number, ARC_RANGE: number, ARC_R: number;
421
421
  export declare const FLOOR_TICKS: number, ARC_KNOCK: number;
422
- /** Ticks into a cut's swing in which a double click's second press still turns it into its special. */
423
- export declare const SPECIAL_LATE = 18;
424
422
  /** The lunge's throw along the look (m/s), held for the burst of a dash: it spends the dash. */
425
423
  export declare const LUNGE_SPEED = 13;
426
424
  /** The leap's jump (m/s up), from a floor only: 1.4 m up and down in 45 ticks, the blow (LEAP's strike) just before the landing. */
@@ -41,6 +41,8 @@ export interface Kit {
41
41
  hp: number;
42
42
  /** Whether the racks give him their weapons and he wears the armour pickups. */
43
43
  gear: boolean;
44
+ /** Carries a katana from spawn. */
45
+ katana?: boolean;
44
46
  /**
45
47
  * The xenomorph's body: claws and a tail for weapons (PUNCHES from BLOW.CLAW_L), clinging to the
46
48
  * walls (MODE.CLING), a dash's burst that pins an enemy it reaches, acid for blood (room.ts).
@@ -37,6 +37,7 @@ export declare const STILL: {
37
37
  hits: number;
38
38
  blade: boolean;
39
39
  wield: boolean;
40
+ fists: boolean;
40
41
  swing: number;
41
42
  cut: number;
42
43
  zap: boolean;
@@ -58,12 +59,12 @@ export declare const STILL: {
58
59
  fall: number;
59
60
  };
60
61
  /** A player standing on spawn point n of a team (modulo the count): the red team's by default. */
61
- export declare const spawn: (id: number, w: World, n: number, team?: number) => PlayerState;
62
+ export declare const spawn: (id: number, w: World, n: number, team?: number, kit?: Kit) => PlayerState;
62
63
  /**
63
64
  * Puts the player back at the spawn of his id in his team, looking where he looked, with full
64
65
  * health and no gun (EV.RESPAWN). The shot and hit counters go on: a reset would read as a shot.
65
66
  */
66
- export declare const respawn: (p: PlayerState, w: World, team: number) => void;
67
+ export declare const respawn: (p: PlayerState, w: World, team: number, kit?: Kit) => void;
67
68
  /** The height of the cylinder in this mode. */
68
69
  export declare const heightOf: (p: Pick<PlayerState, "mode">) => number;
69
70
  /** The camera height above the feet in this mode. */
@@ -74,6 +74,8 @@ export declare const KEY: {
74
74
  readonly RIFLE: 8192;
75
75
  /** Press to get into the rover at hand, or out of the one he rides. */
76
76
  readonly USE: 16384;
77
+ /** Select bare hands even while carrying a weapon. */
78
+ readonly FISTS: 32768;
77
79
  };
78
80
  /**
79
81
  * The katana's cuts (PlayerState.cut, constants CUTS), chosen by the keys held when FIRE starts
@@ -267,6 +269,8 @@ export interface PlayerState {
267
269
  blade?: boolean;
268
270
  /** The katana is in hand rather than the gun (see KEY.BLADE). Absent reads false. */
269
271
  wield?: boolean;
272
+ /** Bare hands selected explicitly; carried weapons remain available. */
273
+ fists?: boolean;
270
274
  /** Ticks left in the katana's swing, CUTS[cut].ticks at its start, 0 when ready. Absent reads 0. */
271
275
  swing?: number;
272
276
  /** CUT of the running or last swing. Absent reads 0. */
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.196.0",
5
+ "version": "0.196.2",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"