From: Vasilis Date: Sun, 14 Jan 2024 05:27:32 +0000 (+0100) Subject: Cvar to allow whitelisted players to bypass panic bunker (#23885) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=22c0b4425d7a955fd995d3b1b3f777cefe3884c8;p=space-station-14.git Cvar to allow whitelisted players to bypass panic bunker (#23885) Among us --- diff --git a/Content.Server/Connection/ConnectionManager.cs b/Content.Server/Connection/ConnectionManager.cs index af25a709dd..f0dd87e2bd 100644 --- a/Content.Server/Connection/ConnectionManager.cs +++ b/Content.Server/Connection/ConnectionManager.cs @@ -114,15 +114,16 @@ namespace Content.Server.Connection var minMinutesAge = _cfg.GetCVar(CCVars.PanicBunkerMinAccountAge); var record = await _dbManager.GetPlayerRecordByUserId(userId); var validAccountAge = record != null && - record.FirstSeenTime.CompareTo(DateTimeOffset.Now - TimeSpan.FromMinutes(minMinutesAge)) <= 0; + record.FirstSeenTime.CompareTo(DateTimeOffset.Now - TimeSpan.FromMinutes(minMinutesAge)) <= 0; + var bypassAllowed = _cfg.GetCVar(CCVars.BypassBunkerWhitelist) && await _db.GetWhitelistStatusAsync(userId); // Use the custom reason if it exists & they don't have the minimum account age - if (customReason != string.Empty && !validAccountAge) + if (customReason != string.Empty && !validAccountAge && !bypassAllowed) { return (ConnectionDenyReason.Panic, customReason, null); } - if (showReason && !validAccountAge) + if (showReason && !validAccountAge && !bypassAllowed) { return (ConnectionDenyReason.Panic, Loc.GetString("panic-bunker-account-denied-reason", @@ -134,19 +135,19 @@ namespace Content.Server.Connection var haveMinOverallTime = overallTime != null && overallTime.TimeSpent.TotalHours > minOverallHours; // Use the custom reason if it exists & they don't have the minimum time - if (customReason != string.Empty && !haveMinOverallTime) + if (customReason != string.Empty && !haveMinOverallTime && !bypassAllowed) { return (ConnectionDenyReason.Panic, customReason, null); } - if (showReason && !haveMinOverallTime) + if (showReason && !haveMinOverallTime && !bypassAllowed) { return (ConnectionDenyReason.Panic, Loc.GetString("panic-bunker-account-denied-reason", ("reason", Loc.GetString("panic-bunker-account-reason-overall", ("hours", minOverallHours)))), null); } - if (!validAccountAge || !haveMinOverallTime) + if (!validAccountAge || !haveMinOverallTime && !bypassAllowed) { return (ConnectionDenyReason.Panic, Loc.GetString("panic-bunker-account-denied"), null); } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 5a315f7055..5f7fa41ecc 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -305,6 +305,12 @@ namespace Content.Shared.CCVar public static readonly CVarDef PanicBunkerCustomReason = CVarDef.Create("game.panic_bunker.custom_reason", string.Empty, CVar.SERVERONLY); + /// + /// Allow bypassing the panic bunker if the user is whitelisted. + /// + public static readonly CVarDef BypassBunkerWhitelist = + CVarDef.Create("game.panic_bunker.whitelisted_can_bypass", true, CVar.SERVERONLY); + /// /// Make people bonk when trying to climb certain objects like tables. ///