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;
using System;
using Content.Server.Stunnable.Components;
using Content.Shared.Audio;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -32,7 +33,7 @@ namespace Content.Server.Damage.Components
[DataField("factor")]
public float Factor { get; set; } = 1f;
[DataField("soundHit")]
public string SoundHit { get; set; } = "";
public SoundSpecifier SoundHit { get; set; } = default!;
[DataField("stunChance")]
public float StunChance { get; set; } = 0.25f;
[DataField("stunMinimumDamage")]
@@ -51,8 +52,8 @@ namespace Content.Server.Damage.Components
if (speed < MinimumSpeed) return;
if (!string.IsNullOrEmpty(SoundHit))
SoundSystem.Play(Filter.Pvs(otherFixture.Body.Owner), SoundHit, otherFixture.Body.Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
if (SoundHit.TryGetSound(out var soundHit))
SoundSystem.Play(Filter.Pvs(otherFixture.Body.Owner), soundHit, otherFixture.Body.Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
if ((_gameTiming.CurTime - _lastHit).TotalSeconds < DamageCooldown)
return;