Small static helper in the SboxSuperuser engine compatibility layer. IsSupported reports whether the current process is the network host running either as a dedicated server or in the editor with explicit opt-in, and Describe formats those flags plus Application.Version into a diagnostic string.
using Sandbox;
namespace SboxSuperuser.Engine.Compatibility;
internal static class ProbeRuntime
{
internal static bool IsSupported( bool allowEditorTesting )
{
return Networking.IsHost
&& (Application.IsDedicatedServer || (Game.IsEditor && allowEditorTesting));
}
internal static string Describe( bool allowEditorTesting )
{
var mode = Application.IsDedicatedServer ? "DedicatedServer" : "EditorTest";
if ( !IsSupported( allowEditorTesting ) )
{
mode = "Unsupported";
}
return $"mode={mode}; engine={Application.Version}; "
+ $"dedicated={Application.IsDedicatedServer}; editor={Game.IsEditor}; "
+ $"host={Networking.IsHost}; editorOptIn={allowEditorTesting}";
}
}