swb_base/Commands.cs

Console command handlers for server/host weapon settings. Provides two ConCmds to toggle weapon customization UI and automatic reload, validating that the caller is the host before changing WeaponSettings singleton properties.

using SWB.Player;

namespace SWB.Base;

public class Commands
{
	[ConCmd( "swb_host_customization", Help = "Enable the weapon customization menu (Q)" )]
	public static void SetWeaponCustomization( int enable )
	{
		var player = PlayerBase.Local;
		if ( !player.IsHost ) return;

		WeaponSettings.Instance.Customization = enable != 0;
	}

	[ConCmd( "swb_host_autoreload", Help = "Reload weapons automatically while shooting if clip is empty" )]
	public static void SetWeaponAutoReload( int enable )
	{
		var player = PlayerBase.Local;
		if ( !player.IsHost ) return;

		WeaponSettings.Instance.AutoReload = enable != 0;
	}
}