Fix upstream

This commit is contained in:
Morb0 2024-10-04 20:05:59 +03:00
parent 3ab6d3ef71
commit 47b58a0282
6 changed files with 20 additions and 30 deletions

View file

@ -425,7 +425,7 @@ namespace Content.Server.Connection
// Corvax-Queue-Start: Make these conditions in one place, for checks in the connection and in the queue
public async Task<bool> HavePrivilegedJoin(NetUserId userId)
{
var adminBypass = _cfg.GetCVar(CCVars.AdminBypassMaxPlayers) && await _dbManager.GetAdminDataForAsync(userId) != null;
var adminBypass = _cfg.GetCVar(CCVars.AdminBypassMaxPlayers) && await _db.GetAdminDataForAsync(userId) != null;
var havePriorityJoin = _sponsorsMgr != null && _sponsorsMgr.HaveServerPriorityJoin(userId); // Corvax-Sponsors
var wasInGame = EntitySystem.TryGet<GameTicker>(out var ticker) &&
ticker.PlayerGameStatuses.TryGetValue(userId, out var status) &&

View file

@ -1,6 +1,7 @@
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;
@ -15,12 +16,11 @@ public sealed partial class TTSSystem
private void RegisterRateLimits()
{
_rateLimitManager.Register(RateLimitKey,
new RateLimitRegistration
{
CVarLimitPeriodLength = CCCVars.TTSRateLimitPeriod,
CVarLimitCount = CCCVars.TTSRateLimitCount,
PlayerLimitedAction = RateLimitPlayerLimited,
});
new RateLimitRegistration(
CCCVars.TTSRateLimitPeriod,
CCCVars.TTSRateLimitCount,
RateLimitPlayerLimited)
);
}
private void RateLimitPlayerLimited(ICommonSession player)

View file

@ -4,6 +4,7 @@ using Content.Server.Players.RateLimiting;
using Content.Shared.Corvax.CCCVars;
using Content.Shared.Corvax.TTS;
using Content.Shared.GameTicking;
using Content.Shared.Players.RateLimiting;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

View file

@ -1,4 +1,5 @@
using Content.Server.Corvax.TTS;
using Content.Shared.Corvax.TTS;
using Content.Shared.VoiceMask;
namespace Content.Server.VoiceMask;
@ -13,30 +14,18 @@ public partial class VoiceMaskSystem
private void OnSpeakerVoiceTransform(EntityUid uid, VoiceMaskComponent component, TransformSpeakerVoiceEvent args)
{
if (component.Enabled)
args.VoiceId = component.VoiceId;
args.VoiceId = component.VoiceId;
}
private void OnChangeVoice(EntityUid uid, VoiceMaskComponent component, VoiceMaskChangeVoiceMessage message)
private void OnChangeVoice(Entity<VoiceMaskComponent> entity, ref VoiceMaskChangeVoiceMessage msg)
{
component.VoiceId = message.Voice;
_popupSystem.PopupEntity(Loc.GetString("voice-mask-voice-popup-success"), uid);
TrySetLastKnownVoice(uid, message.Voice);
UpdateUI(uid, component);
}
private void TrySetLastKnownVoice(EntityUid maskWearer, string? voiceId)
{
if (!HasComp<VoiceMaskComponent>(maskWearer)
|| !_inventory.TryGetSlotEntity(maskWearer, MaskSlot, out var maskEntity)
|| !TryComp<VoiceMaskerComponent>(maskEntity, out var maskComp))
{
if (msg.Voice is { } id && !_proto.HasIndex<TTSVoicePrototype>(id))
return;
}
maskComp.LastSetVoice = voiceId;
entity.Comp.VoiceId = msg.Voice;
_popupSystem.PopupEntity(Loc.GetString("voice-mask-voice-popup-success"), entity);
UpdateUI(entity);
}
}

View file

@ -59,8 +59,8 @@ public sealed class CCCVars
/// Tts rate limit values are accounted in periods of this size (seconds).
/// After the period has passed, the count resets.
/// </summary>
public static readonly CVarDef<int> TTSRateLimitPeriod =
CVarDef.Create("tts.rate_limit_period", 2, CVar.SERVERONLY);
public static readonly CVarDef<float> TTSRateLimitPeriod =
CVarDef.Create("tts.rate_limit_period", 2f, CVar.SERVERONLY);
/// <summary>
/// How many tts preview messages are allowed in a single rate limit period.

View file

@ -5,7 +5,7 @@ namespace Content.Shared.VoiceMask;
[Serializable, NetSerializable]
public sealed class VoiceMaskChangeVoiceMessage : BoundUserInterfaceMessage
{
public string Voice { get; }
public string Voice;
public VoiceMaskChangeVoiceMessage(string voice)
{