ball2d 0.3.0 → 0.3.2-next.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.
@@ -1,44 +1,40 @@
1
+ import type { MatchXgRuntimeConfig, MatchXgRuntimeStatus } from './match-xg-runtime.js';
1
2
  import type { HostPlayer, HostScores, HostDiscProperties } from './player.js';
2
3
  import type { DiscPropertyPatch } from './disc.js';
3
4
  import type { MatchState } from './match-state.js';
4
5
  import type { AnnouncementStyle } from './announcement.js';
6
+ import type { RoomHooks } from './room-hooks.js';
7
+ import type { AtmospherePack, AtmospherePolicy, CommentaryCue, CommentaryGoalGeometry, CommentaryPlayerFact, CommentaryPlayerFactInput, CommentaryPolicy, CommentaryPolicyPatch } from './commentary.js';
8
+ import type { MatchIntelligencePolicy, MatchIntelligencePolicyPatch, MatchIntelligenceRoleAssignment, MatchIntelligenceRoleInput, MatchIntelligenceSnapshot } from './match-intelligence.js';
5
9
  /** Public room contract: runtime classes and transport types are deliberately absent. */
6
- export interface Room {
10
+ export interface Room extends RoomHooks {
7
11
  readonly roomId: string;
8
12
  readonly roomLink: string;
9
13
  readonly roomName: string;
10
14
  readonly signal: AbortSignal;
11
15
  readonly lastRecording: Blob | null;
12
- onRecordingComplete?: (blob: Blob, reason: string) => void;
13
- onRoomLink?: (url: string) => void;
14
- onPlayerJoin?: (p: HostPlayer) => void;
15
- onPlayerTeamChange?: (p: HostPlayer, byPlayer: HostPlayer | null) => void;
16
- onPlayerMuteChange?: (p: HostPlayer, byPlayer: HostPlayer | null) => void;
17
- onPlayerAdminChange?: (p: HostPlayer, byPlayer: HostPlayer | null) => void;
18
- onGameStart?: (byPlayer: HostPlayer | null) => void;
19
- onGameStop?: (byPlayer: HostPlayer | null) => void;
20
- onTeamVictory?: (scores: HostScores) => void;
21
- /** Legacy Ball2D callback; prefer onTeamVictory. */
22
- onGameVictory?: (scores: HostScores) => void;
23
- onGamePauseChange?: (paused: boolean) => void;
24
- onGamePause?: (byPlayer: HostPlayer | null) => void;
25
- onGameUnpause?: (byPlayer: HostPlayer | null) => void;
26
- onPlayerLeave?: (p: HostPlayer) => void;
27
- onPlayerKicked?: (p: HostPlayer, reason: string, ban: boolean, byPlayer: HostPlayer | null) => void;
28
- onPlayerActivity?: (p: HostPlayer) => void;
29
- /** Runs only when a peer changes its accepted key state; prevInput is the previous authoritative bitmask. */
30
- onPlayerInput?: (p: HostPlayer, prevInput: number) => void;
31
- onPlayerChat?: (p: HostPlayer, text: string) => boolean | void;
32
- /** Host-visible direct chat; return false to suppress delivery to both participants. */
33
- onPlayerDirectChat?: (p: HostPlayer, recipient: HostPlayer, text: string) => boolean | void;
34
- onPlayerBallKick?: (p: HostPlayer) => void;
35
- onTeamGoal?: (team: 1 | 2) => void;
36
- onPositionsReset?: () => void;
37
- onStadiumChange?: (name: string, byPlayer: HostPlayer | null) => void;
38
- onTeamsLockChange?: (locked: boolean, byPlayer: HostPlayer | null) => void;
39
- onKickRateLimitSet?: (min: number, rate: number, burst: number, byPlayer: HostPlayer | null) => void;
40
- onGameTick?: () => void;
41
- onError?: (message: string) => void;
16
+ /** Host-local opt-in; preparation performs hashes outside the simulation loop. null disables. */
17
+ setMatchXgConfig(config: MatchXgRuntimeConfig | null): Promise<void>;
18
+ getMatchXgStatus(): MatchXgRuntimeStatus;
19
+ setCommentaryPolicy(patch: CommentaryPolicyPatch): Promise<void>;
20
+ getCommentaryPolicy(): CommentaryPolicy;
21
+ setMatchIntelligencePolicy(patch: MatchIntelligencePolicyPatch): Promise<void>;
22
+ getMatchIntelligencePolicy(): MatchIntelligencePolicy;
23
+ /** Replaces all explicit role assignments; [] clears them. Only current field players qualify. */
24
+ setMatchIntelligenceRoles(roles: readonly MatchIntelligenceRoleInput[]): Promise<void>;
25
+ getMatchIntelligenceRoles(): readonly MatchIntelligenceRoleAssignment[];
26
+ /** In-memory observations for this match, never persistent player statistics. */
27
+ getMatchIntelligenceSnapshot(): MatchIntelligenceSnapshot;
28
+ setPlayerCommentaryContext(id: number, facts: readonly CommentaryPlayerFactInput[] | null): Promise<void>;
29
+ getPlayerCommentaryContext(id: number): CommentaryPlayerFact[];
30
+ setCommentaryGeometry(goals: readonly CommentaryGoalGeometry[] | null): Promise<void>;
31
+ getCommentaryGeometry(): readonly CommentaryGoalGeometry[];
32
+ setCommentaryCatalog(cues: readonly CommentaryCue[] | null): Promise<void>;
33
+ getCommentaryCatalog(): readonly CommentaryCue[] | null;
34
+ setAtmospherePolicy(patch: Partial<AtmospherePolicy>): Promise<void>;
35
+ getAtmospherePolicy(): AtmospherePolicy;
36
+ setAtmospherePack(pack: AtmospherePack | null): Promise<void>;
37
+ getAtmospherePack(): AtmospherePack | null;
42
38
  getPlayerList(): HostPlayer[];
43
39
  getPlayer(id: number): HostPlayer | null;
44
40
  setTeamColors(team: number, angle: number, textColor: number, colors: number[]): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ball2d",
3
- "version": "0.3.0",
3
+ "version": "0.3.2-next.0",
4
4
  "description": "Ball2D SDK for browser integration and API-key-authorized Node.js room hosting",
5
5
  "type": "module",
6
6
  "sideEffects": false,