diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.Fill.cs b/Content.Server/Storage/EntitySystems/StorageSystem.Fill.cs index 77fb387b41..9a58ff87e8 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.Fill.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.Fill.cs @@ -8,7 +8,6 @@ public sealed partial class StorageSystem private void OnStorageFillMapInit(EntityUid uid, StorageFillComponent component, MapInitEvent args) { if (component.Contents.Count == 0) return; - if (!EntityManager.EntitySysManager.TryGetEntitySystem(out var entityStorage)) return; TryComp(uid, out var serverStorageComp); TryComp(uid, out var entityStorageComp); @@ -27,10 +26,10 @@ public sealed partial class StorageSystem var ent = EntityManager.SpawnEntity(item, coordinates); // handle depending on storage component, again this should be unified after ECS - if (entityStorageComp != null && entityStorage.Insert(ent, uid)) + if (entityStorageComp != null && _entityStorage.Insert(ent, uid)) continue; - if (serverStorageComp != null && Insert(uid, ent, serverStorageComp)) + if (serverStorageComp != null && Insert(uid, ent, serverStorageComp, false)) continue; Logger.ErrorS("storage", $"Tried to StorageFill {item} inside {ToPrettyString(uid)} but can't."); diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index b580194ecf..45b74d329c 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -47,6 +47,7 @@ namespace Content.Server.Storage.EntitySystems [Dependency] private readonly SharedInteractionSystem _sharedInteractionSystem = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; /// public override void Initialize() @@ -529,9 +530,8 @@ namespace Content.Server.Storage.EntitySystems /// /// Inserts into the storage container /// - /// The entity to insert /// true if the entity was inserted, false otherwise - public bool Insert(EntityUid uid, EntityUid insertEnt, ServerStorageComponent? storageComp = null) + public bool Insert(EntityUid uid, EntityUid insertEnt, ServerStorageComponent? storageComp = null, bool playSound = true) { if (!Resolve(uid, ref storageComp)) return false; @@ -539,8 +539,10 @@ namespace Content.Server.Storage.EntitySystems if (!CanInsert(uid, insertEnt, out _, storageComp) || storageComp.Storage?.Insert(insertEnt) == false) return false; - if (storageComp.StorageInsertSound is not null) - SoundSystem.Play(storageComp.StorageInsertSound.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid, AudioParams.Default); + if (playSound && storageComp.StorageInsertSound is not null) + { + _audio.PlayPvs(storageComp.StorageInsertSound, uid); + } RecalculateStorageUsed(storageComp); UpdateStorageUI(uid, storageComp);