mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-05 04:48:19 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
25 lines
608 B
C#
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;
|
|
}
|
|
}
|