removed TryGetSound + made some SoundSpecifier datafields required

This commit is contained in:
Galactic Chimp
2021-07-31 19:52:33 +02:00
parent 8ff703c338
commit 57016d14b4
114 changed files with 519 additions and 785 deletions

View File

@@ -22,7 +22,7 @@ namespace Content.Server.Damage.Components
public int BaseDamage { get; set; } = 5;
[DataField("factor")]
public float Factor { get; set; } = 1f;
[DataField("soundHit")]
[DataField("soundHit", required: true)]
public SoundSpecifier SoundHit { get; set; } = default!;
[DataField("stunChance")]
public float StunChance { get; set; } = 0.25f;

View File

@@ -34,8 +34,7 @@ namespace Content.Server.Damage
if (speed < component.MinimumSpeed) return;
if (component.SoundHit.TryGetSound(out var soundHit))
SoundSystem.Play(Filter.Pvs(otherBody), soundHit, otherBody, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
SoundSystem.Play(Filter.Pvs(otherBody), component.SoundHit.GetSound(), otherBody, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
if ((_gameTiming.CurTime - component.LastHit).TotalSeconds < component.DamageCooldown)
return;