Skip to content

Commit

Permalink
play sound when lighting and snuffing a cigar
Browse files Browse the repository at this point in the history
  • Loading branch information
deltanedas committed Sep 24, 2024
1 parent bb82e09 commit 7c96635
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Content.Server/Nutrition/EntitySystems/SmokingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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!;
Expand Down Expand Up @@ -72,6 +74,12 @@ public void SetSmokableState(EntityUid uid, SmokableState state, SmokableCompone
EnsureComp<BurningComponent>(uid);
else
RemComp<BurningComponent>(uid);

var sound = state == SmokableState.Lit
? smokable.LightSound
: smokable.SnuffSound;

_audio.PlayPvs(sound, uid);
}

private void OnSmokableIsHotEvent(Entity<SmokableComponent> entity, ref IsHotEvent args)
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/Nutrition/Components/SmokableComponent.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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");
}
}

0 comments on commit 7c96635

Please sign in to comment.