Files
sbox-public/engine/Sandbox.Engine/Game/LaunchArguments.cs
Sol Williams 1f4d4ffa98 Party pass (#4592)
* Accepting party invites from Steam overlay works
* Menu start/join/play buttons are only enabled for the lobby leader
* Can kick players from your party
* Attempting to connect to a different server from the party leader will leave the party (e.g. if you accept another game invite from Steam overlay or our friends list)
* Added message boxes for party join failure reasons
* Can no longer join parties in editor
* Can create lobbies with MaxPlayers 1
2026-04-21 20:11:35 +01:00

51 lines
1.3 KiB
C#

using Sandbox.Network;
namespace Sandbox;
/// <summary>
/// These are arguments that were set when launching the current game.
/// This is used to pre-configure the game from the menu
/// </summary>
public static class LaunchArguments
{
/// <summary>
/// The map to start with. It's really up to the game to use this
/// </summary>
public static string Map { get; set; }
/// <summary>
/// Preferred max players for multiplayer games. Used by games, but not enforced.
/// </summary>
public static int MaxPlayers { get; set; }
/// <summary>
/// Default privacy for lobbies created on game start.
/// </summary>
public static LobbyPrivacy Privacy { get; set; } = LobbyPrivacy.Public;
/// <summary>
/// The game settings to apply on join. These are a list of convars.
/// </summary>
public static Dictionary<string, string> GameSettings { get; set; }
/// <summary>
/// The hostname for the server.
/// </summary>
public static string ServerName { get; set; }
/// <summary>
/// Should be called when leaving a game to set the properties back to default. We need to be
/// aware and prevent these leaking between games.
/// </summary>
internal static void Reset()
{
GameSettings = default;
Map = default;
Privacy = default;
ServerName = default;
MaxPlayers = 0;
}
// TODO - save launch arguments and restore them, per game.
}