diff --git a/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs b/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs index 19e16ae678..49047e4897 100644 --- a/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Content.Server.GameObjects.EntitySystems.DoAfter; diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 3a6d29b0a4..6397edfc50 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -1,10 +1,11 @@ -#nullable enable +#nullable enable using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Content.Server.GameObjects.Components.GUI; using Content.Server.Interfaces.GameObjects.Components.Items; +using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Storage; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces; @@ -13,16 +14,22 @@ using Content.Shared.Utility; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.EntitySystemMessages; +using Robust.Server.GameObjects.EntitySystems; using Robust.Server.Interfaces.Player; using Robust.Server.Player; +using Robust.Shared.Audio; using Robust.Shared.Enums; using Robust.Shared.GameObjects; +using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Network; +using Robust.Shared.Interfaces.Random; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Players; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -46,6 +53,8 @@ namespace Content.Server.GameObjects.Components.Items.Storage private int _storageCapacityMax; public readonly HashSet SubscribedSessions = new(); + public string? StorageSoundCollection { get; set; } + [ViewVariables] public override IReadOnlyList? StoredEntities => _storage?.ContainedEntities; @@ -135,6 +144,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage return; } + PlaySoundCollection(StorageSoundCollection); EnsureInitialCalculated(); Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) had entity (UID {message.Entity.Uid}) inserted into it."); @@ -207,6 +217,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage /// The entity to open the UI for public void OpenStorageUI(IEntity entity) { + PlaySoundCollection(StorageSoundCollection); EnsureInitialCalculated(); var userSession = entity.GetComponent().playerSession; @@ -331,6 +342,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage serializer.DataField(ref _storageCapacityMax, "capacity", 10000); serializer.DataField(ref _occludesLight, "occludesLight", true); + serializer.DataField(this, x => x.StorageSoundCollection, "storageSoundCollection", string.Empty); //serializer.DataField(ref StorageUsed, "used", 0); } @@ -494,5 +506,17 @@ namespace Content.Server.GameObjects.Components.Items.Storage } } } + + protected void PlaySoundCollection(string? name) + { + if (string.IsNullOrEmpty(name)) + { + return; + } + + var file = AudioHelpers.GetRandomFileFromSoundCollection(name); + EntitySystem.Get() + .PlayFromEntity(file, Owner, AudioParams.Default); + } } } diff --git a/Resources/Audio/Effects/rustle1.ogg b/Resources/Audio/Effects/rustle1.ogg new file mode 100644 index 0000000000..365fb5d85f Binary files /dev/null and b/Resources/Audio/Effects/rustle1.ogg differ diff --git a/Resources/Audio/Effects/rustle2.ogg b/Resources/Audio/Effects/rustle2.ogg new file mode 100644 index 0000000000..031aeb8a8e Binary files /dev/null and b/Resources/Audio/Effects/rustle2.ogg differ diff --git a/Resources/Audio/Effects/rustle3.ogg b/Resources/Audio/Effects/rustle3.ogg new file mode 100644 index 0000000000..1bbdfb2500 Binary files /dev/null and b/Resources/Audio/Effects/rustle3.ogg differ diff --git a/Resources/Audio/Effects/rustle4.ogg b/Resources/Audio/Effects/rustle4.ogg new file mode 100644 index 0000000000..1401fca0c7 Binary files /dev/null and b/Resources/Audio/Effects/rustle4.ogg differ diff --git a/Resources/Audio/Effects/rustle5.ogg b/Resources/Audio/Effects/rustle5.ogg new file mode 100644 index 0000000000..ac10981b80 Binary files /dev/null and b/Resources/Audio/Effects/rustle5.ogg differ diff --git a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml index a386ca2a7c..614642b9e3 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml @@ -15,6 +15,7 @@ sprite: Clothing/Back/Backpacks/backpack.rsi - type: Storage capacity: 100 + storageSoundCollection : storageRustle - type: entity parent: ClothingBackpack diff --git a/Resources/Prototypes/Entities/Clothing/Back/duffel.yml b/Resources/Prototypes/Entities/Clothing/Back/duffel.yml index 8aba363413..030eb987c0 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/duffel.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/duffel.yml @@ -15,7 +15,8 @@ - back - type: Storage capacity: 100 - + storageSoundCollection : storageRustle + - type: entity parent: ClothingBackpackDuffel id: ClothingBackpackDuffelEngineering diff --git a/Resources/Prototypes/Entities/Clothing/Back/satchel.yml b/Resources/Prototypes/Entities/Clothing/Back/satchel.yml index 093a23f874..c2b7944466 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/satchel.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/satchel.yml @@ -15,7 +15,8 @@ sprite: Clothing/Back/Satchels/satchel.rsi - type: Storage capacity: 100 - + storageSoundCollection : storageRustle + - type: entity parent: ClothingBackpackSatchel id: ClothingBackpackSatchelEngineering diff --git a/Resources/Prototypes/SoundCollections/storage_rustle.yml b/Resources/Prototypes/SoundCollections/storage_rustle.yml new file mode 100644 index 0000000000..d7f6c09586 --- /dev/null +++ b/Resources/Prototypes/SoundCollections/storage_rustle.yml @@ -0,0 +1,8 @@ +- type: soundCollection + id: storageRustle + files: + - /Audio/Effects/rustle1.ogg + - /Audio/Effects/rustle2.ogg + - /Audio/Effects/rustle3.ogg + - /Audio/Effects/rustle4.ogg + - /Audio/Effects/rustle5.ogg