codeAPI Reference
s&box IToolInfo: Tool information display interface
IToolInfo API Reference
IToolInfo is an interface for providing tool information display in the UI, such as in the spawn menu or tool selector.
Type Signature
CSHARP
public interface IToolInfo : IValid
{
string Name { get; }
string Description { get; }
string PrimaryAction => null;
string SecondaryAction => null;
string ReloadAction => null;
}Properties
- string Name { get; } - The display name of the tool.
- string Description { get; } - A description of what the tool does.
- string PrimaryAction => null - Description of the primary action (e.g., "Fire"). Override to customize.
- string SecondaryAction => null - Description of the secondary action (e.g., "Zoom"). Override to customize.
- string ReloadAction => null - Description of the reload action. Override to customize.
Usage
Implement this interface on ToolMode classes or other tool-related components:
CSHARP
public class BalloonTool : ToolMode, IToolInfo
{
public string Name => "Balloon";
public string Description => "Spawn balloons that float upward";
public string PrimaryAction => "Spawn Balloon";
public string SecondaryAction => "Remove Balloon";
}Notes
- Inherits from IValid for validity checking.
- Used by the UI to display tool information to players.
- Default implementations return null for action descriptions.
- Action descriptions are typically shown in HUD or tooltips.
Was this helpful?