Partial class Carryable, viewmodel creation override. It ensures only the local human player's carried items create a first-person view model by checking Owner validity, local player flag, and that the player's Controller and Renderer are valid before calling base.CreateViewModel().
public partial class Carryable
{
/// <summary>
/// Only the human player driving this client gets a view model. The engine's own guard is
/// <c>IsProxy || !IsHeld</c>, which is also true for a bot's weapon on the host - so without this
/// the host would build a first-person model for every bot it simulates.
/// </summary>
protected override void CreateViewModel()
{
var player = Owner;
if ( !player.IsValid() || !player.IsLocalPlayer )
return;
if ( !player.Controller.IsValid() || !player.Controller.Renderer.IsValid() )
return;
base.CreateViewModel();
}
}