mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
feat: per-sub-room max players, editable in game and from admin
Player caps were two settings pretending to be one. RoomEntity.MaxCapacity is
what the ROOM advertises (and what matchmaking hands to
RoomInstance.MaxCapacity); RoomSceneEntity.MaxPlayers is what ONE sub-room caps
itself at. The details payload was reading its room-level MaxPlayers off
sub-room 0, which collapsed the two — editing a sub-room would have moved the
room's advertised capacity with it. It now reports MaxCapacity, and each entry
in SubRooms[] reports its own figure.
The in-game path already existed (the "Max Player Count in This Subroom"
slider). Admin had no way to reach it at all — only zip import ever set it — so
a cap could not be corrected on a room the admin does not own:
GET api/admin/v1/rooms/{id}/subrooms
PUT api/admin/v1/rooms/{id}/subrooms/{subRoomId}/maxplayers {"MaxPlayers":n}
subRoomId is the sub-room's ORDER INDEX — the id the client and the rest of the
wire use — not the row's primary key. Row ids are serialised as strings because
the admin SPA is JavaScript and mangles integers past 2^53. Both paths clamp to
1..80, matching rooms/{id}/props: 0 would make a sub-room unjoinable, and a
shared range stops the two settings disagreeing about what is legal.
The test drives the client's exact wire rather than a convenient one:
NLDBPDCNNCF.MNBPCGJNLNP builds a BLNOGFGHIIF whose single JSON key is
"maxPlayers" and PUTs it — this route does NOT form-encode like most of its
siblings, so a form-bodied test would have passed while the real client's body
went unread. It also asserts the reply carries the new value, since the client
deserialises it back as FGCPNAACHIK.
This commit is contained in:
@@ -2143,9 +2143,12 @@ public class RoomsController(
|
||||
// name-keyed reader, presence does.
|
||||
DataBlob = dataBlobName,
|
||||
DataBlobHash = (string?)null,
|
||||
// Room-level cap mirrors sub-room 0, which is where the client
|
||||
// reads it from for a single-sub-room room.
|
||||
MaxPlayers = sceneRows is { Count: > 0 } ? sceneRows[0].MaxPlayers : 8,
|
||||
// The room-level cap is the room's own advertised capacity, which is
|
||||
// what RoomEntity.MaxCapacity exists for and what matchmaking hands
|
||||
// to RoomInstance.MaxCapacity. Each sub-room carries its own
|
||||
// MaxPlayers in the SubRooms array — they are separate settings, so
|
||||
// this must not be read off sub-room 0.
|
||||
MaxPlayers = room.MaxCapacity,
|
||||
// ToxMod is Rec Room's hosted voice moderation. There is no such
|
||||
// service here, so it is off — the client only uses this to decide
|
||||
// whether to show the indicator.
|
||||
|
||||
Reference in New Issue
Block a user