replacing sound (collection) names with SoundSpecifier - part 1
This commit is contained in:
@@ -8,12 +8,14 @@ using Content.Shared.Doors;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.Wires.SharedWiresComponent;
|
||||
using static Content.Shared.Wires.SharedWiresComponent.WiresAction;
|
||||
@@ -92,6 +94,10 @@ namespace Content.Server.Doors.Components
|
||||
}
|
||||
}
|
||||
|
||||
[DataField("setBoltsDownSound")] private SoundSpecifier _setBoltsDownSound = new SoundPathSpecifier("/Audio/Machines/boltsdown.ogg");
|
||||
|
||||
[DataField("setBoltsUpSound")] private SoundSpecifier _setBoltsUpSound = new SoundPathSpecifier("/Audio/Machines/boltsup.ogg");
|
||||
|
||||
private static readonly TimeSpan AutoCloseDelayFast = TimeSpan.FromSeconds(1);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -456,7 +462,16 @@ namespace Content.Server.Doors.Components
|
||||
|
||||
BoltsDown = newBolts;
|
||||
|
||||
SoundSystem.Play(Filter.Broadcast(), newBolts ? "/Audio/Machines/boltsdown.ogg" : "/Audio/Machines/boltsup.ogg", Owner);
|
||||
if (newBolts)
|
||||
{
|
||||
if (_setBoltsDownSound.TryGetSound(out var boltsDownSound))
|
||||
SoundSystem.Play(Filter.Broadcast(), boltsDownSound, Owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_setBoltsUpSound.TryGetSound(out var boltsUpSound))
|
||||
SoundSystem.Play(Filter.Broadcast(), boltsUpSound, Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Tool;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -43,6 +44,9 @@ namespace Content.Server.Doors.Components
|
||||
[DataField("board")]
|
||||
private string? _boardPrototype;
|
||||
|
||||
[DataField("tryOpenDoorSound")]
|
||||
private SoundSpecifier _tryOpenDoorSound = new SoundPathSpecifier("/Audio/Effects/bang.ogg");
|
||||
|
||||
public override DoorState State
|
||||
{
|
||||
get => base.State;
|
||||
@@ -235,10 +239,10 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
Open();
|
||||
|
||||
if (user.TryGetComponent(out HandsComponent? hands) && hands.Count == 0)
|
||||
if (user.TryGetComponent(out HandsComponent? hands) && hands.Count == 0
|
||||
&& _tryOpenDoorSound.TryGetSound(out var tryOpenDoorSound))
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/bang.ogg", Owner,
|
||||
AudioParams.Default.WithVolume(-2));
|
||||
SoundSystem.Play(Filter.Pvs(Owner), tryOpenDoorSound, Owner, AudioParams.Default.WithVolume(-2));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user