Exemplo n.º 1
0
 /// <summary>
 /// This fires when the rider presses the honk action
 /// </summary>
 private void OnHonk(EntityUid uid, VehicleComponent vehicle, HonkActionEvent args)
 {
     if (args.Handled)
     {
         return;
     }
     if (vehicle.HornSound != null)
     {
         SoundSystem.Play(vehicle.HornSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.1f).WithVolume(8f));
         args.Handled = true;
     }
 }
        /// <summary>
        /// This fires when the rider presses the honk action
        /// </summary>
        private void OnHonk(EntityUid uid, VehicleComponent vehicle, HonkActionEvent args)
        {
            if (args.Handled || vehicle.HornSound == null)
            {
                return;
            }

            // TODO: Need audio refactor maybe, just some way to null it when the stream is over.
            // For now better to just not loop to keep the code much cleaner.
            vehicle.HonkPlayingStream?.Stop();
            vehicle.HonkPlayingStream = SoundSystem.Play(vehicle.HornSound.GetSound(), Filter.Pvs(uid), uid, vehicle.HornSound.Params);
            args.Handled = true;
        }