replacing sound (collection) names with SoundSpecifier - part 1

This commit is contained in:
Galactic Chimp
2021-07-10 17:35:33 +02:00
parent 4500b66f28
commit ce3c59e0e6
131 changed files with 934 additions and 587 deletions

View File

@@ -1,8 +1,9 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Content.Server.Camera;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Projectiles;
using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics.Collision;
@@ -33,9 +34,7 @@ namespace Content.Server.Projectiles.Components
// Get that juicy FPS hit sound
[DataField("soundHit")]
private string? _soundHit = default;
[DataField("soundHitSpecies")]
private string? _soundHitSpecies = default;
private SoundSpecifier _soundHit = default!;
private bool _damagedEntity;
@@ -64,13 +63,9 @@ namespace Content.Server.Projectiles.Components
var coordinates = otherFixture.Body.Owner.Transform.Coordinates;
var playerFilter = Filter.Pvs(coordinates);
if (otherFixture.Body.Owner.TryGetComponent(out IDamageableComponent? damage) && _soundHitSpecies != null)
if (otherFixture.Body.Owner.TryGetComponent(out IDamageableComponent? damage) && _soundHit.TryGetSound(out var soundHit))
{
SoundSystem.Play(playerFilter, _soundHitSpecies, coordinates);
}
else if (_soundHit != null)
{
SoundSystem.Play(playerFilter, _soundHit, coordinates);
SoundSystem.Play(playerFilter, soundHit, coordinates);
}
if (damage != null)