Component that plays a rattle sound for an SCP-173 controller. It checks the linked Player__Controller each update and starts the Rattle SoundPointComponent when the player is moving and not jumping, otherwise it stops the sound.
using Sandbox;
public class SCP_173_SFX : Component
{
[Property] public Player__Controller Player_Controller {get;set;}
[Property] public SoundPointComponent Rattle {get;set;}
protected override void OnUpdate()
{ if (IsProxy) return;
if (Player_Controller.IsMoving && !Player_Controller.IsJumping)
{Rattle.StartSound(); return;}
Rattle.StopSound();
}
}