storage open sound has cooldown now (#14811)
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.Hands.Components;
|
|||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
|
using Content.Shared.Timing;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -59,6 +60,7 @@ namespace Content.Server.Storage.EntitySystems
|
|||||||
[Dependency] private readonly SharedCombatModeSystem _combatMode = default!;
|
[Dependency] private readonly SharedCombatModeSystem _combatMode = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -601,8 +603,14 @@ namespace Content.Server.Storage.EntitySystems
|
|||||||
if (!Resolve(uid, ref storageComp) || !TryComp(entity, out ActorComponent? player))
|
if (!Resolve(uid, ref storageComp) || !TryComp(entity, out ActorComponent? player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// prevent spamming bag open / honkerton honk sound
|
||||||
|
silent |= TryComp<UseDelayComponent>(uid, out var useDelay) && _useDelay.ActiveDelay(uid, useDelay);
|
||||||
if (!silent)
|
if (!silent)
|
||||||
|
{
|
||||||
_audio.PlayPvs(storageComp.StorageOpenSound, uid);
|
_audio.PlayPvs(storageComp.StorageOpenSound, uid);
|
||||||
|
if (useDelay != null)
|
||||||
|
_useDelay.BeginDelay(uid, useDelay);
|
||||||
|
}
|
||||||
|
|
||||||
Logger.DebugS(storageComp.LoggerName, $"Storage (UID {uid}) \"used\" by player session (UID {player.PlayerSession.AttachedEntity}).");
|
Logger.DebugS(storageComp.LoggerName, $"Storage (UID {uid}) \"used\" by player session (UID {player.PlayerSession.AttachedEntity}).");
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.StorageUiKey.Key
|
- key: enum.StorageUiKey.Key
|
||||||
type: StorageBoundUserInterface
|
type: StorageBoundUserInterface
|
||||||
|
# to prevent bag open/honk spam
|
||||||
|
- type: UseDelay
|
||||||
|
delay: 0.5
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ClothingBackpack
|
parent: ClothingBackpack
|
||||||
|
|||||||
Reference in New Issue
Block a user