mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using Content.Server.Chat.Managers;
|
|
using Content.Server.Players.RateLimiting;
|
|
using Content.Shared.Corvax.CCCVars;
|
|
using Content.Shared.Players.RateLimiting;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.Corvax.TTS;
|
|
|
|
public sealed partial class TTSSystem
|
|
{
|
|
[Dependency] private PlayerRateLimitManager _rateLimitManager = default!;
|
|
[Dependency] private IChatManager _chat = default!;
|
|
|
|
private const string RateLimitKey = "TTS";
|
|
|
|
private void RegisterRateLimits()
|
|
{
|
|
_rateLimitManager.Register(RateLimitKey,
|
|
new RateLimitRegistration(
|
|
CCCVars.TTSRateLimitPeriod,
|
|
CCCVars.TTSRateLimitCount,
|
|
RateLimitPlayerLimited)
|
|
);
|
|
}
|
|
|
|
private void RateLimitPlayerLimited(ICommonSession player)
|
|
{
|
|
_chat.DispatchServerMessage(player, Loc.GetString("tts-rate-limited"), suppressLog: true);
|
|
}
|
|
|
|
private RateLimitStatus HandleRateLimit(ICommonSession player)
|
|
{
|
|
return _rateLimitManager.CountAction(player, RateLimitKey);
|
|
}
|
|
}
|