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

@@ -78,12 +78,12 @@ namespace Content.Server.Weapon.Melee
if (target != null)
{
// Raise event before doing damage so we can cancel damage if the event is handled
var hitEvent = new MeleeHitEvent(new List<IEntity>() {target}, args.User);
var hitEvent = new MeleeHitEvent(new List<IEntity>() { target }, args.User);
RaiseLocalEvent(uid, hitEvent, false);
if (!hitEvent.Handled)
{
var targets = new[] {target};
var targets = new[] { target };
SendAnimation(comp.ClickArc, angle, args.User, owner, targets, comp.ClickAttackEffect, false);
if (target.TryGetComponent(out IDamageableComponent? damageableComponent))
@@ -91,14 +91,12 @@ namespace Content.Server.Weapon.Melee
damageableComponent.ChangeDamage(comp.DamageType, comp.Damage, false, owner);
}
if(comp.HitSound.TryGetSound(out var hitSound))
SoundSystem.Play(Filter.Pvs(owner), hitSound, target);
SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), target);
}
}
else
{
if(comp.MissSound.TryGetSound(out var missSound))
SoundSystem.Play(Filter.Pvs(owner), missSound, args.User);
SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), args.User);
return;
}
@@ -148,13 +146,11 @@ namespace Content.Server.Weapon.Melee
{
if (entities.Count != 0)
{
if(comp.HitSound.TryGetSound(out var hitSound))
SoundSystem.Play(Filter.Pvs(owner), hitSound, entities.First().Transform.Coordinates);
SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), entities.First().Transform.Coordinates);
}
else
{
if(comp.MissSound.TryGetSound(out var missSound))
SoundSystem.Play(Filter.Pvs(owner), missSound, args.User.Transform.Coordinates);
SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), args.User.Transform.Coordinates);
}
foreach (var entity in hitEntities)