Predict EmitSoundOnUIOpen (#31464)
* Predict EmitSoundOnUIOpen BUI prediction led to this moment. * unforky
This commit is contained in:
parent
2e1b486e8b
commit
83ec967455
4 changed files with 18 additions and 19 deletions
|
|
@ -1,12 +0,0 @@
|
|||
using Content.Shared.Sound.Components;
|
||||
|
||||
namespace Content.Server.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on AfterActivatableUIOpenEvent
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -39,15 +39,9 @@ public sealed class EmitSoundSystem : SharedEmitSoundSystem
|
|||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<EmitSoundOnTriggerComponent, TriggerEvent>(HandleEmitSoundOnTrigger);
|
||||
SubscribeLocalEvent<EmitSoundOnUIOpenComponent, AfterActivatableUIOpenEvent>(HandleEmitSoundOnUIOpen);
|
||||
SubscribeLocalEvent<SpamEmitSoundComponent, MapInitEvent>(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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on AfterActivatableUIOpenEvent
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class EmitSoundOnUIOpenComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
|
|
@ -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<EmitSoundOnPickupComponent, GotEquippedHandEvent>(OnEmitSoundOnPickup);
|
||||
SubscribeLocalEvent<EmitSoundOnDropComponent, DroppedEvent>(OnEmitSoundOnDrop);
|
||||
SubscribeLocalEvent<EmitSoundOnInteractUsingComponent, InteractUsingEvent>(OnEmitSoundOnInteractUsing);
|
||||
SubscribeLocalEvent<EmitSoundOnUIOpenComponent, AfterActivatableUIOpenEvent>(HandleEmitSoundOnUIOpen);
|
||||
|
||||
SubscribeLocalEvent<EmitSoundOnCollideComponent, StartCollideEvent>(OnEmitSoundOnCollide);
|
||||
|
||||
SubscribeLocalEvent<SoundWhileAliveComponent, MobStateChangedEvent>(OnMobState);
|
||||
}
|
||||
|
||||
private void HandleEmitSoundOnUIOpen(EntityUid uid, EmitSoundOnUIOpenComponent component, AfterActivatableUIOpenEvent args)
|
||||
{
|
||||
TryEmitSound(uid, component, args.User);
|
||||
}
|
||||
|
||||
private void OnMobState(Entity<SoundWhileAliveComponent> entity, ref MobStateChangedEvent args)
|
||||
{
|
||||
// Disable this component rather than removing it because it can be brought back to life.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue