From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Mon, 26 Aug 2024 07:40:14 +0000 (+1000)
Subject: Predict EmitSoundOnUIOpen (#31464)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=83ec96745563e129020adc71942500ba911352ce;p=space-station-14.git
Predict EmitSoundOnUIOpen (#31464)
* Predict EmitSoundOnUIOpen
BUI prediction led to this moment.
* unforky
---
diff --git a/Content.Server/Sound/Components/EmitSoundOnUIOpenComponent.cs b/Content.Server/Sound/Components/EmitSoundOnUIOpenComponent.cs
deleted file mode 100644
index 44e83b0e79..0000000000
--- a/Content.Server/Sound/Components/EmitSoundOnUIOpenComponent.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Content.Shared.Sound.Components;
-
-namespace Content.Server.Sound.Components
-{
- ///
- /// Simple sound emitter that emits sound on AfterActivatableUIOpenEvent
- ///
- [RegisterComponent]
- public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent
- {
- }
-}
diff --git a/Content.Server/Sound/EmitSoundSystem.cs b/Content.Server/Sound/EmitSoundSystem.cs
index fc10d951e7..9d7e8496c3 100644
--- a/Content.Server/Sound/EmitSoundSystem.cs
+++ b/Content.Server/Sound/EmitSoundSystem.cs
@@ -39,15 +39,9 @@ public sealed class EmitSoundSystem : SharedEmitSoundSystem
base.Initialize();
SubscribeLocalEvent(HandleEmitSoundOnTrigger);
- SubscribeLocalEvent(HandleEmitSoundOnUIOpen);
SubscribeLocalEvent(HandleSpamEmitSoundMapInit);
}
- private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
- {
- TryEmitSound(uid, component, args.User, false);
- }
-
private void HandleEmitSoundOnTrigger(EntityUid uid, EmitSoundOnTriggerComponent component, TriggerEvent args)
{
TryEmitSound(uid, component, args.User, false);
diff --git a/Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs
new file mode 100644
index 0000000000..a979a6ec50
--- /dev/null
+++ b/Content.Shared/Sound/Components/EmitSoundOnUIOpenComponent.cs
@@ -0,0 +1,11 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Sound.Components;
+
+///
+/// Simple sound emitter that emits sound on AfterActivatableUIOpenEvent
+///
+[RegisterComponent, NetworkedComponent]
+public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent
+{
+}
diff --git a/Content.Shared/Sound/SharedEmitSoundSystem.cs b/Content.Shared/Sound/SharedEmitSoundSystem.cs
index efc18abaa0..8733edf485 100644
--- a/Content.Shared/Sound/SharedEmitSoundSystem.cs
+++ b/Content.Shared/Sound/SharedEmitSoundSystem.cs
@@ -1,6 +1,5 @@
using Content.Shared.Audio;
using Content.Shared.Hands;
-using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Maps;
@@ -8,6 +7,7 @@ using Content.Shared.Mobs;
using Content.Shared.Popups;
using Content.Shared.Sound.Components;
using Content.Shared.Throwing;
+using Content.Shared.UserInterface;
using Content.Shared.Whitelist;
using JetBrains.Annotations;
using Robust.Shared.Audio;
@@ -48,12 +48,18 @@ public abstract class SharedEmitSoundSystem : EntitySystem
SubscribeLocalEvent(OnEmitSoundOnPickup);
SubscribeLocalEvent(OnEmitSoundOnDrop);
SubscribeLocalEvent(OnEmitSoundOnInteractUsing);
+ SubscribeLocalEvent(HandleEmitSoundOnUIOpen);
SubscribeLocalEvent(OnEmitSoundOnCollide);
SubscribeLocalEvent(OnMobState);
}
+ private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
+ {
+ TryEmitSound(uid, component, args.User);
+ }
+
private void OnMobState(Entity entity, ref MobStateChangedEvent args)
{
// Disable this component rather than removing it because it can be brought back to life.