Code/SboxSuperuser/Engine/Compatibility/ProbeRuntime.cs

Utility class that checks whether the current runtime is supported for a probe operation and returns a short descriptive string. IsSupported returns true only when this instance is the networking host and either a dedicated server or running in the editor with an explicit opt-in. Describe returns a compact status string with mode, engine version, flags for dedicated, editor, host and the allowEditorTesting flag.

Networking
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}";
	}
}