mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
feat: Implement adjustable room capacity and quest team size
- Added MaxCapacity property to RoomEntity and updated related controllers to utilize it. - Modified RoomsController to set MaxPlayers based on room's MaxCapacity. - Introduced QuestTeamSize class to dynamically adjust quest party sizes beyond the default limit. - Updated DevMenu to include options for debugging and managing room settings. - Created UI elements for adjusting MaxCapacity in the admin interface. - Added configuration file for DevMenu with default settings.
This commit is contained in:
@@ -1200,7 +1200,7 @@ public class RoomsController(
|
||||
Name = "Home",
|
||||
IsSandbox = false,
|
||||
DataBlobName = dataBlobName,
|
||||
MaxPlayers = 8,
|
||||
MaxPlayers = room.MaxCapacity,
|
||||
CanMatchmakeInto = true,
|
||||
// Use the room's actual UpdatedAt so the watch's
|
||||
// "is my local cache stale?" check sees an accurate
|
||||
|
||||
@@ -903,7 +903,8 @@ public class AdminController(
|
||||
string? TagsCsv,
|
||||
double? HotScore,
|
||||
int? State,
|
||||
string? ImageName);
|
||||
string? ImageName,
|
||||
int? MaxCapacity);
|
||||
|
||||
/// <summary>POST <c>api/admin/v1/rooms/{id}/props</c> — partial
|
||||
/// update of room properties. Only the non-null fields in the
|
||||
@@ -926,6 +927,13 @@ public class AdminController(
|
||||
if (body.HotScore is double h) { room.HotScore = h; changes.Add($"hot={h}"); }
|
||||
if (body.State is int st) { room.State = st; changes.Add($"state={st}"); }
|
||||
if (body.ImageName is string img) { room.ImageName = img; changes.Add($"image={img}"); }
|
||||
if (body.MaxCapacity is int cap)
|
||||
{
|
||||
// Clamp to a sane range. Note: advertised cap only on the 2020.12
|
||||
// client today (no Photon hard-enforce) — see RoomEntity.MaxCapacity.
|
||||
room.MaxCapacity = Math.Clamp(cap, 1, 80);
|
||||
changes.Add($"maxCapacity={room.MaxCapacity}");
|
||||
}
|
||||
|
||||
if (changes.Count == 0) return Ok(new { room.Id, unchanged = true });
|
||||
|
||||
@@ -989,6 +997,7 @@ public class AdminController(
|
||||
room.SupportsWalkVR,
|
||||
room.SupportsTeleportVR,
|
||||
room.AllowsJuniors,
|
||||
room.MaxCapacity,
|
||||
room.DisableMicAutoMute,
|
||||
room.RoomWarningMask,
|
||||
room.CustomRoomWarning,
|
||||
|
||||
@@ -1026,6 +1026,7 @@ public class GoToController(
|
||||
// baked-in DormRoom mapping for unknown names.
|
||||
long roomId;
|
||||
string locationId;
|
||||
var maxCapacity = 8; // admin-adjustable per-room cap; 8 = default/fallback
|
||||
if (roomName.Equals("DormRoom", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Each player has their own dorm row (created at signup,
|
||||
@@ -1038,6 +1039,7 @@ public class GoToController(
|
||||
var personal = await rooms.EnsurePersonalDormAsync(callerPid);
|
||||
roomId = personal.Id;
|
||||
locationId = personal.LocationReplicationId;
|
||||
maxCapacity = personal.MaxCapacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1055,6 +1057,7 @@ public class GoToController(
|
||||
{
|
||||
roomId = room.Id;
|
||||
locationId = room.LocationReplicationId;
|
||||
maxCapacity = room.MaxCapacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1103,7 +1106,7 @@ public class GoToController(
|
||||
PhotonRegionId = photonRegion,
|
||||
PhotonRoomId = photonRoom,
|
||||
Name = dormInstanceName,
|
||||
MaxCapacity = 8,
|
||||
MaxCapacity = maxCapacity,
|
||||
IsFull = false,
|
||||
IsPrivate = false,
|
||||
IsInProgress = true,
|
||||
|
||||
@@ -351,7 +351,7 @@ public class MatchPlayerController(
|
||||
location: location,
|
||||
dataBlob: dataBlob,
|
||||
photonRegion: photonRegion,
|
||||
maxCapacity: 8,
|
||||
maxCapacity: personal.MaxCapacity,
|
||||
photonRoomId: photonRoomId);
|
||||
|
||||
return new RoomInstanceDto
|
||||
@@ -363,7 +363,7 @@ public class MatchPlayerController(
|
||||
PhotonRegionId = photonRegion,
|
||||
PhotonRoomId = photonRoomId,
|
||||
Name = dormInstanceName,
|
||||
MaxCapacity = 8,
|
||||
MaxCapacity = personal.MaxCapacity,
|
||||
IsFull = false,
|
||||
IsPrivate = true,
|
||||
IsInProgress = true,
|
||||
|
||||
Reference in New Issue
Block a user