Weapons/WeaponModel/WorldModel.cs

A world-space weapon model class that implements IWeaponEvent. It sets an attack animation on attack, and when not in first-person it spawns muzzle and brass ejection effects. It also creates ranged effects (tracer) when the weapon has no view model.

Native Interop
using static BaseWeapon;

public sealed class WorldModel : WeaponModel, IWeaponEvent
{
	void IWeaponEvent.OnAttack( IWeaponEvent.AttackEvent e )
	{
		Renderer?.Set( "b_attack", true );

		if ( e.isFirstPerson )
			return;

		DoMuzzleEffect();
		DoEjectBrass();
	}

	void IWeaponEvent.CreateRangedEffects( BaseWeapon weapon, Vector3 hitPoint, Vector3? origin )
	{
		if ( weapon.ViewModel.IsValid() )
			return;

		DoTracerEffect( hitPoint, origin );
	}
}