Files
sbox-public/engine/Sandbox.Engine/Systems/Networking/Networking.Debug.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

25 lines
608 B
C#

using Sandbox.Network;
namespace Sandbox.Debug;
public static class Networking
{
/// <summary>
/// Add an empty connection for debugging purposes. This connection cannot receive or send data and
/// it won't be visible to other clients.
/// </summary>
public static void AddEmptyConnection()
{
if ( !Sandbox.Networking.IsActive )
return;
var connection = new EmptyConnection( Guid.NewGuid() );
var system = Sandbox.Networking.System;
system.OnConnected( connection );
system.AddConnection( connection, UserInfo.Local );
connection.State = Connection.ChannelState.Connected;
}
}