SboxSuperuser/Components/CompatibilityProbe.Chat.cs

Partial of the CompatibilityProbe component that implements IChatEvent. Forwards incoming chat messages to ProbeChat.Observe, but only when the probe is allowed to run and this instance is the active probe.

using Sandbox;
using SboxSuperuser.Engine.Compatibility;

namespace SboxSuperuser.Components;

public sealed partial class CompatibilityProbe : IChatEvent
{
	void IChatEvent.OnChatMessage( ChatMessageEvent message )
	{
		if ( CanRun && FindActiveProbe() == this )
		{
			ProbeChat.Observe( message );
		}
	}
}