replacing sound (collection) names with SoundSpecifier - part 1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -50,7 +51,7 @@ namespace Content.Server.Projectiles.Components
|
||||
[DataField("impactFlash")]
|
||||
private string? _impactFlash;
|
||||
[DataField("soundHitWall")]
|
||||
private string _soundHitWall = "/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg";
|
||||
private SoundSpecifier _soundHitWall = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg");
|
||||
|
||||
public void FireEffects(IEntity user, float distance, Angle angle, IEntity? hitEntity = null)
|
||||
{
|
||||
@@ -85,7 +86,8 @@ namespace Content.Server.Projectiles.Components
|
||||
// TODO: No wall component so ?
|
||||
var offset = angle.ToVec().Normalized / 2;
|
||||
var coordinates = user.Transform.Coordinates.Offset(offset);
|
||||
SoundSystem.Play(Filter.Pvs(coordinates), _soundHitWall, coordinates);
|
||||
if(_soundHitWall.TryGetSound(out var soundHitWall))
|
||||
SoundSystem.Play(Filter.Pvs(coordinates), soundHitWall, coordinates);
|
||||
}
|
||||
|
||||
Owner.SpawnTimer((int) _deathTime.TotalMilliseconds, () =>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user