prevent typing sound from playing when AI interacts with consoles (#32906)

* prevent typing sound from playing when AI interacts with consoles

* cleanup
This commit is contained in:
MendaxxDev
2024-10-21 05:50:05 +02:00
committed by GitHub
parent 1d2ad3c335
commit b5687e4c73
6 changed files with 18 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Whitelist;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
namespace Content.Shared.Sound.Components; namespace Content.Shared.Sound.Components;
@@ -8,4 +9,9 @@ namespace Content.Shared.Sound.Components;
[RegisterComponent, NetworkedComponent] [RegisterComponent, NetworkedComponent]
public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent 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();
} }

View File

@@ -57,9 +57,12 @@ public abstract class SharedEmitSoundSystem : EntitySystem
} }
private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args) private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
{
if (_whitelistSystem.IsBlacklistFail(component.Blacklist, args.User))
{ {
TryEmitSound(uid, component, args.User); TryEmitSound(uid, component, args.User);
} }
}
private void OnMobState(Entity<SoundWhileAliveComponent> entity, ref MobStateChangedEvent args) private void OnMobState(Entity<SoundWhileAliveComponent> entity, ref MobStateChangedEvent args)
{ {

View File

@@ -12,6 +12,7 @@
- CanPilot - CanPilot
- BypassInteractionRangeChecks - BypassInteractionRangeChecks
- BypassDropChecks - BypassDropChecks
- NoConsoleSound
- type: Input - type: Input
context: "aghost" context: "aghost"
- type: Ghost - type: Ghost

View File

@@ -374,6 +374,7 @@
tags: tags:
- HideContextMenu - HideContextMenu
- StationAi - StationAi
- NoConsoleSound
# Hologram projection that the AI's eye tracks. # Hologram projection that the AI's eye tracks.
- type: entity - type: entity

View File

@@ -62,6 +62,9 @@
volume: -1 volume: -1
variation: 0.10 variation: 0.10
pitch: 1.10 # low pitch keyboard sounds feel kinda weird pitch: 1.10 # low pitch keyboard sounds feel kinda weird
blacklist:
tags:
- NoConsoleSound
- type: ContainerContainer - type: ContainerContainer
containers: containers:
board: !type:Container board: !type:Container

View File

@@ -987,6 +987,9 @@
- type: Tag - type: Tag
id: NoBlockAnchoring id: NoBlockAnchoring
- type: Tag
id: NoConsoleSound
- type: Tag - type: Tag
id: NozzleBackTank id: NozzleBackTank