@genex-ai/multiplayer 0.12.1 → 0.13.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.d.ts CHANGED
@@ -204,6 +204,19 @@ type Session<TState extends Record<string, unknown>> = {
204
204
  * by the relay itself (`state`, `shared`, `claim`, `obj`, `release`, `destroy`, and the
205
205
  * `match:`/`__` prefixes) are refused with a console warning — pick another name. */
206
206
  send(type: string, payload?: unknown): void;
207
+ /**
208
+ * HOST ONLY. Stop (or resume) the matchmaker placing NEW players into THIS room.
209
+ *
210
+ * For a lobby game: call `setRoomOpen(false)` when your match starts, so arrivals
211
+ * form the NEXT room instead of dropping into a fight already in progress, and
212
+ * `setRoomOpen(true)` when you return to the lobby. Everyone already in the room
213
+ * keeps playing, and a reconnecting player still gets back in (reconnection uses a
214
+ * reserved seat, not matchmaking).
215
+ *
216
+ * Ignored (with no error) when called by a non-host — read `isHost` first. All
217
+ * clients are told either way, so you can render "closed" from the `room:open` event.
218
+ */
219
+ setRoomOpen(open: boolean): void;
207
220
  /** Leave the room (deliberate — no auto-reconnect, no `disconnect` event). */
208
221
  leave(): void;
209
222
  };
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ var CAPABILITIES_REQUEST_MSG = "__capabilities:request";
25
25
  var OBJECT_CONTROL_RESULT_MSG = "__object:result";
26
26
  var OBJECT_CONTROL_VERSION = 2;
27
27
  var STATE_SNAP_MSG = "__state:snap";
28
+ var ROOM_OPEN_MSG = "__room:open";
28
29
  var OBJECT_SNAP_MSG = "__object:snap";
29
30
  var MP_PROTOCOL = 2;
30
31
  async function relayClient(opts) {
@@ -913,6 +914,9 @@ function attachSession(client, initialRoom) {
913
914
  }
914
915
  send0(type, payload, true);
915
916
  },
917
+ setRoomOpen(open) {
918
+ room.send(ROOM_OPEN_MSG, { open });
919
+ },
916
920
  leave() {
917
921
  intentionalLeave = true;
918
922
  connected = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/multiplayer",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "The multiplayer client wrapper + shared room schema for genex.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",