]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add sound for turning on grill (#31099)
authorthemias <89101928+themias@users.noreply.github.com>
Sat, 17 Aug 2024 00:41:55 +0000 (20:41 -0400)
committerGitHub <noreply@github.com>
Sat, 17 Aug 2024 00:41:55 +0000 (20:41 -0400)
* Add sound for turning on grill

* remove view variable

Content.Server/Temperature/Components/EntityHeaterComponent.cs
Content.Server/Temperature/Systems/EntityHeaterSystem.cs
Resources/Prototypes/Entities/Structures/Machines/grill.yml

index 3a162c20e3253aefeaf57d1a4c3d024dcec7ac31..0b5acb421a899f4cc888fadc4e09200c8e1ae0ef 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Server.Temperature.Systems;
 using Content.Shared.Temperature;
+using Robust.Shared.Audio;
 
 namespace Content.Server.Temperature.Components;
 
@@ -21,4 +22,10 @@ public sealed partial class EntityHeaterComponent : Component
     /// </summary>
     [DataField]
     public EntityHeaterSetting Setting = EntityHeaterSetting.Off;
+
+    /// <summary>
+    /// An optional sound that plays when the setting is changed.
+    /// </summary>
+    [DataField]
+    public SoundPathSpecifier? SettingSound;
 }
index 6da774ba076edf0b478e61daf8485d63bd6ec37b..ffc796cbb22130cb96de89cd878e1e345cf72b49 100644 (file)
@@ -5,6 +5,7 @@ using Content.Shared.Placeable;
 using Content.Shared.Popups;
 using Content.Shared.Temperature;
 using Content.Shared.Verbs;
+using Robust.Server.Audio;
 
 namespace Content.Server.Temperature.Systems;
 
@@ -16,6 +17,7 @@ public sealed class EntityHeaterSystem : EntitySystem
     [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
     [Dependency] private readonly TemperatureSystem _temperature = default!;
+    [Dependency] private readonly AudioSystem _audio = default!;
 
     private readonly int SettingCount = Enum.GetValues(typeof(EntityHeaterSetting)).Length;
 
@@ -92,6 +94,7 @@ public sealed class EntityHeaterSystem : EntitySystem
         comp.Setting = setting;
         power.Load = SettingPower(setting, comp.Power);
         _appearance.SetData(uid, EntityHeaterVisuals.Setting, setting);
+        _audio.PlayPvs(comp.SettingSound, uid);
     }
 
     private float SettingPower(EntityHeaterSetting setting, float max)
index dbd31b3eae26f1c06a9ac296a218827de84d85e5..9c4c67b95114658bf1418d567f21bf4f1cac42ed 100644 (file)
   - type: ApcPowerReceiver
     powerLoad: 0 # off by default
   - type: EntityHeater
+    settingSound: 
+      path: /Audio/Weapons/click.ogg
+      params:
+        volume: -6
   - type: ItemPlacer
     maxEntities: 4 # big grill, many steaks
     whitelist: