mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# Description I don't like the bwoink. I also don't like being notified about the thing I'm staring at. If anyone has better quality sounds to suggest, I might use those instead. --- <details><summary><h1>Media</h1></summary> <p> ## Different sounds https://github.com/user-attachments/assets/8003f785-0cd0-44c9-94c2-919c59adac5c ## Ignore sounds when looking https://github.com/user-attachments/assets/2ac99672-a601-41e0-a5cd-25ce9c1a5c49 </p> </details> --- # Changelog 🆑 - tweak: The AdminHelp sound has changed to three that play under different circumstances --------- Signed-off-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>
50 lines
2.0 KiB
C#
50 lines
2.0 KiB
C#
#nullable enable
|
|
using Content.Client.UserInterface.Systems.Bwoink;
|
|
using Content.Shared.Administration;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.Audio;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Client.Administration.Systems
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class BwoinkSystem : SharedBwoinkSystem
|
|
{
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
[Dependency] private readonly AudioSystem _audio = default!;
|
|
[Dependency] private readonly AdminSystem _adminSystem = default!;
|
|
|
|
public event EventHandler<BwoinkTextMessage>? OnBwoinkTextMessageRecieved;
|
|
private (TimeSpan Timestamp, bool Typing) _lastTypingUpdateSent;
|
|
|
|
protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySessionEventArgs eventArgs)
|
|
{
|
|
OnBwoinkTextMessageRecieved?.Invoke(this, message);
|
|
}
|
|
|
|
public void Send(NetUserId channelId, string text, bool playSound)
|
|
{
|
|
var info = _adminSystem.PlayerInfos.GetValueOrDefault(channelId)?.Connected ?? true;
|
|
_audio.PlayGlobal(info ? AHelpUIController.AHelpSendSound : AHelpUIController.AHelpErrorSound,
|
|
Filter.Local(), false);
|
|
|
|
// Reuse the channel ID as the 'true sender'.
|
|
// Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help.
|
|
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound));
|
|
SendInputTextUpdated(channelId, false);
|
|
}
|
|
|
|
public void SendInputTextUpdated(NetUserId channel, bool typing)
|
|
{
|
|
if (_lastTypingUpdateSent.Typing == typing &&
|
|
_lastTypingUpdateSent.Timestamp + TimeSpan.FromSeconds(1) > _timing.RealTime)
|
|
return;
|
|
|
|
_lastTypingUpdateSent = (_timing.RealTime, typing);
|
|
RaiseNetworkEvent(new BwoinkClientTypingUpdated(channel, typing));
|
|
}
|
|
}
|
|
}
|