* Graft from https://github.com/space-wizards/space-station-14/pull/3049
* 'openahelp' command
* Add AHelp into escape menu
* Add a way to ahelp a player from the kick window
* bwoink: XAMLify, bugfix, etc.
* Rename the kick/bwoink window the Player Actions Panel
* Add the bwoink sound y'all know and love
adminhelp.ogg taken from d775e1ac80/sound/effects/adminhelp.ogg
(available in master, therefore see master license: "All assets including icons and sound are under a Creative Commons 3.0 BY-SA license unless otherwise indicated.")
"Changed the adminhelpsound to some creative commons sound I pinched. Until somebody can get a better one. I'm sick of MAAAAAAAAOOOOOOW."
Actual source is https://freesound.org/people/martian/sounds/19261/ (CC0)
The sound had been reversed and the volume altered.
* Actually play the bwoink sound on receiving an ahelp that you didn't send
55 lines
1.9 KiB
C#
55 lines
1.9 KiB
C#
#nullable enable
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using Content.Server.Administration.Managers;
|
|
using Content.Shared.Administration;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.GameObjects.Components;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Players;
|
|
using Robust.Shared.Network;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Server.Administration
|
|
{
|
|
[UsedImplicitly]
|
|
public class BwoinkSystem : SharedBwoinkSystem
|
|
{
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
[Dependency] private readonly IAdminManager _adminManager = default!;
|
|
|
|
protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySessionEventArgs eventArgs)
|
|
{
|
|
base.OnBwoinkTextMessage(message, eventArgs);
|
|
var senderSession = (IPlayerSession) eventArgs.SenderSession;
|
|
|
|
// TODO: Sanitize text?
|
|
// Confirm that this person is actually allowed to send a message here.
|
|
if ((senderSession.UserId != message.ChannelId) && (_adminManager.GetAdminData(senderSession) == null))
|
|
{
|
|
// Unauthorized bwoink (log?)
|
|
return;
|
|
}
|
|
|
|
var msg = new BwoinkTextMessage(message.ChannelId, senderSession.UserId, $"{senderSession.Name}: {message.Text}");
|
|
|
|
LogBwoink(msg);
|
|
|
|
var targets = _adminManager.ActiveAdmins.Select(p => p.ConnectedClient);
|
|
|
|
// Admins
|
|
foreach (var channel in targets)
|
|
RaiseNetworkEvent(msg, channel);
|
|
|
|
// And involved player
|
|
if (_playerManager.TryGetSessionById(message.ChannelId, out var session))
|
|
if (!targets.Contains(session.ConnectedClient))
|
|
RaiseNetworkEvent(msg, session.ConnectedClient);
|
|
}
|
|
}
|
|
}
|
|
|