diff --git a/Content.Shared/Lock/LockSystem.cs b/Content.Shared/Lock/LockSystem.cs index 3c0f6560da..145d77c523 100644 --- a/Content.Shared/Lock/LockSystem.cs +++ b/Content.Shared/Lock/LockSystem.cs @@ -13,6 +13,7 @@ using JetBrains.Annotations; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Network; +using Robust.Shared.Player; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -25,7 +26,6 @@ namespace Content.Shared.Lock; public sealed class LockSystem : EntitySystem { [Dependency] private readonly IGameTiming _timing = default!; - [Dependency] private readonly INetManager _net = default!; [Dependency] private readonly AccessReaderSystem _accessReader = default!; [Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; @@ -87,8 +87,9 @@ public sealed class LockSystem : EntitySystem { if (!component.Locked) return; - if (!args.Silent && _net.IsServer) - _sharedPopupSystem.PopupEntity(Loc.GetString("entity-storage-component-locked-message"), uid); + + if (!args.Silent) + _sharedPopupSystem.PopupClient(Loc.GetString("entity-storage-component-locked-message"), uid, args.User); args.Cancelled = true; } @@ -119,11 +120,8 @@ public sealed class LockSystem : EntitySystem if (!HasUserAccess(uid, user, quiet: false)) return false; - if (_net.IsServer) - { - _sharedPopupSystem.PopupEntity(Loc.GetString("lock-comp-do-lock-success", + _sharedPopupSystem.PopupClient(Loc.GetString("lock-comp-do-lock-success", ("entityName", Identity.Name(uid, EntityManager))), uid, user); - } _audio.PlayPredicted(lockComp.LockSound, uid, user, AudioParams.Default.WithVolume(-5)); lockComp.Locked = true; @@ -146,14 +144,12 @@ public sealed class LockSystem : EntitySystem if (!Resolve(uid, ref lockComp)) return; - if (_net.IsServer) + if (user is { Valid: true }) { - if (user is { Valid: true }) - { - _sharedPopupSystem.PopupEntity(Loc.GetString("lock-comp-do-unlock-success", - ("entityName", Identity.Name(uid, EntityManager))), uid, user.Value); - } + _sharedPopupSystem.PopupClient(Loc.GetString("lock-comp-do-unlock-success", + ("entityName", Identity.Name(uid, EntityManager))), uid, user.Value); } + _audio.PlayPredicted(lockComp.UnlockSound, uid, user, AudioParams.Default.WithVolume(-5)); lockComp.Locked = false; @@ -210,8 +206,8 @@ public sealed class LockSystem : EntitySystem if (_accessReader.IsAllowed(user, reader)) return true; - if (!quiet && _net.IsClient && _timing.IsFirstTimePredicted) - _sharedPopupSystem.PopupEntity(Loc.GetString("lock-comp-has-user-access-fail"), uid, user); + if (!quiet && _timing.IsFirstTimePredicted) + _sharedPopupSystem.PopupEntity(Loc.GetString("lock-comp-has-user-access-fail"), uid, Filter.Local(), true); return false; } diff --git a/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs b/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs index 9f6b9413a0..f920bb29d1 100644 --- a/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs +++ b/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs @@ -159,7 +159,7 @@ public record struct InsertIntoEntityStorageAttemptEvent(bool Cancelled = false) public record struct StoreMobInItemContainerAttemptEvent(bool Handled, bool Cancelled = false); [ByRefEvent] -public record struct StorageOpenAttemptEvent(bool Silent, bool Cancelled = false); +public record struct StorageOpenAttemptEvent(EntityUid User, bool Silent, bool Cancelled = false); [ByRefEvent] public readonly record struct StorageBeforeOpenEvent; diff --git a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs index abcaec6cb6..da27be0c93 100644 --- a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs @@ -340,7 +340,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem } } - var ev = new StorageOpenAttemptEvent(silent); + var ev = new StorageOpenAttemptEvent(user, silent); RaiseLocalEvent(target, ref ev, true); return !ev.Cancelled;