Components/IToolgunEvent.cs

Interface declaring a toolgun scene event type and a nested SelectEvent record used when a player attempts to select an object with the toolgun. It defines a Cancelled flag and a User property, and a default empty handler method OnToolgunSelect.

public interface IToolgunEvent : ISceneEvent<IToolgunEvent>
{
	public class SelectEvent
	{
		/// <summary>
		/// The connection attempting to use a tool on this object.
		/// </summary>
		public Connection User { get; init; }

		/// <summary>
		/// Set to true to reject the toolgun selection.
		/// </summary>
		public bool Cancelled { get; set; }
	}

	/// <summary>
	/// Called when a player attempts to select this object with the toolgun.
	/// Set <see cref="SelectEvent.Cancelled"/> to true to reject the selection.
	/// </summary>
	void OnToolgunSelect( SelectEvent e ) { }
}