Files
sbox-public/engine/Sandbox.Engine/Systems/Networking/System/LobbyConfig.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

47 lines
1.5 KiB
C#

namespace Sandbox.Network;
[Expose]
public struct LobbyConfig
{
/// <summary>
/// Whether to automatically destroy this lobby when the host leaves. This is only
/// applicable to P2P lobbies.
/// </summary>
public bool DestroyWhenHostLeaves { get; set; }
/// <summary>
/// Whether to periodically switch to the best possible host candidate. This is only
/// applicable to P2P lobbies.
/// </summary>
public bool AutoSwitchToBestHost { get; set; }
/// <summary>
/// Whether to hide this lobby from appearing in the server list. It will still be
/// queryable programatically, so long as the <see cref="Privacy"/> mode allows it.
/// </summary>
public bool Hidden { get; set; }
/// <summary>
/// Determines who is able to connect to this lobby. This will be public by default.
/// </summary>
public LobbyPrivacy Privacy { get; set; }
/// <summary>
/// The maximum amount of players this lobby can hold. By default, this will be
/// the Max Players set in the current Game Package's project settings.
/// </summary>
public int MaxPlayers { get; set; }
/// <summary>
/// The name of this lobby. If this isn't set, a default lobby name will be chosen instead.
/// </summary>
public string Name { get; set; }
public LobbyConfig()
{
DestroyWhenHostLeaves = ProjectSettings.Networking.DestroyLobbyWhenHostLeaves;
AutoSwitchToBestHost = ProjectSettings.Networking.AutoSwitchToBestHost;
MaxPlayers = Application.GamePackage?.GetCachedMeta( "MaxPlayers", 32 ) ?? 32;
}
}