From 7c9663587b2af680a73adb05737e273037dc9d95 Mon Sep 17 00:00:00 2001 From: deltanedas <@deltanedas:kde.org> Date: Tue, 24 Sep 2024 05:08:02 +0100 Subject: [PATCH] play sound when lighting and snuffing a cigar --- Content.Server/Nutrition/EntitySystems/SmokingSystem.cs | 8 ++++++++ Content.Shared/Nutrition/Components/SmokableComponent.cs | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs index 4b027b2977a882..6f7ff2878780a0 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs @@ -15,6 +15,7 @@ using Content.Shared.Smoking; using Content.Shared.Temperature; using Robust.Server.GameObjects; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using System.Linq; @@ -29,6 +30,7 @@ public sealed partial class SmokingSystem : EntitySystem [Dependency] private readonly TransformSystem _transformSystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly ClothingSystem _clothing = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedItemSystem _items = default!; [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; @@ -72,6 +74,12 @@ public void SetSmokableState(EntityUid uid, SmokableState state, SmokableCompone EnsureComp(uid); else RemComp(uid); + + var sound = state == SmokableState.Lit + ? smokable.LightSound + : smokable.SnuffSound; + + _audio.PlayPvs(sound, uid); } private void OnSmokableIsHotEvent(Entity entity, ref IsHotEvent args) diff --git a/Content.Shared/Nutrition/Components/SmokableComponent.cs b/Content.Shared/Nutrition/Components/SmokableComponent.cs index e5cbd27242c40f..1c7d4ac5145b6a 100644 --- a/Content.Shared/Nutrition/Components/SmokableComponent.cs +++ b/Content.Shared/Nutrition/Components/SmokableComponent.cs @@ -1,5 +1,6 @@ using Content.Shared.FixedPoint; using Content.Shared.Smoking; +using Robust.Shared.Audio; using Robust.Shared.GameStates; namespace Content.Shared.Nutrition.Components @@ -32,5 +33,11 @@ public sealed partial class SmokableComponent : Component public string LitPrefix = "lit"; [DataField("unlitPrefix")] public string UnlitPrefix = "unlit"; + + [DataField] + public SoundSpecifier? LightSound = new SoundPathSpecifier("/Audio/Effects/cig_light.ogg"); + + [DataField] + public SoundSpecifier? SnuffSound = new SoundPathSpecifier("/Audio/Effects/cig_snuff.ogg"); } }