]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
prevent typing sound from playing when AI interacts with consoles (#32906)
authorMendaxxDev <153332064+MendaxxDev@users.noreply.github.com>
Mon, 21 Oct 2024 03:50:05 +0000 (05:50 +0200)
committerGitHub <noreply@github.com>
Mon, 21 Oct 2024 03:50:05 +0000 (22:50 -0500)
* prevent typing sound from playing when AI interacts with consoles

* cleanup

Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs
Content.Shared/Sound/SharedEmitSoundSystem.cs
Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
Resources/Prototypes/Entities/Mobs/Player/silicon.yml
Resources/Prototypes/Entities/Structures/Machines/Computers/base_structurecomputers.yml
Resources/Prototypes/tags.yml

index a979a6ec50e05ee73f19baaa3c514b4c2e2d721a..65848cb5e57d5cb94de4746c519b66eed378dde8 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Shared.Whitelist;
 using Robust.Shared.GameStates;
 
 namespace Content.Shared.Sound.Components;
@@ -8,4 +9,9 @@ namespace Content.Shared.Sound.Components;
 [RegisterComponent, NetworkedComponent]
 public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent
 {
+    /// <summary>
+    /// Blacklist for making the sound not play if certain entities open the UI
+    /// </summary>
+    [DataField]
+    public EntityWhitelist Blacklist = new();
 }
index 8040910dc3c7999503bc527e4207cbb3dea03baf..3e051fff3177702c211056573f197a3e89122895 100644 (file)
@@ -58,7 +58,10 @@ public abstract class SharedEmitSoundSystem : EntitySystem
 
     private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
     {
-        TryEmitSound(uid, component, args.User);
+        if (_whitelistSystem.IsBlacklistFail(component.Blacklist, args.User))
+        {
+            TryEmitSound(uid, component, args.User);
+        }
     }
 
     private void OnMobState(Entity<SoundWhileAliveComponent> entity, ref MobStateChangedEvent args)
index 0f1c77e2624dc7dd31d104b0c929adc09f627304..1c3862e99a32ef556c6ce9803ea91878d66450da 100644 (file)
@@ -12,6 +12,7 @@
     - CanPilot
     - BypassInteractionRangeChecks
     - BypassDropChecks
+    - NoConsoleSound
   - type: Input
     context: "aghost"
   - type: Ghost
index 9c906bd1a1c8d2f111c8da5e0484058d9d1c9d2e..c9164b14d13239cc9ce4d2f70bf204dcdbc4915e 100644 (file)
     tags:
     - HideContextMenu
     - StationAi
+    - NoConsoleSound
 
 # Hologram projection that the AI's eye tracks.
 - type: entity
index e961cf94d3c8d4cf333dd3646d2221d498554513..d79348bfa6128ed0a1da51b749ccea87c0babc4d 100644 (file)
@@ -62,6 +62,9 @@
         volume: -1
         variation: 0.10
         pitch: 1.10  # low pitch keyboard sounds feel kinda weird
+    blacklist:
+      tags:
+      - NoConsoleSound
   - type: ContainerContainer
     containers:
       board: !type:Container
index 4f9d0eb3f8cde4e6b64a6173ba22c8071913fc51..d3ffcdcac13afae25d33206a8145f2ca39624c4d 100644 (file)
 - type: Tag
   id: NoBlockAnchoring
 
+- type: Tag
+  id: NoConsoleSound
+
 - type: Tag
   id: NozzleBackTank