Auto DeAdmin sooner (#26551)
Co-authored-by: wrexbe <wrexbe@protonmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Server.Discord;
|
|||||||
using Content.Server.GameTicking.Events;
|
using Content.Server.GameTicking.Events;
|
||||||
using Content.Server.Ghost;
|
using Content.Server.Ghost;
|
||||||
using Content.Server.Maps;
|
using Content.Server.Maps;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
@@ -194,26 +195,18 @@ namespace Content.Server.GameTicking
|
|||||||
|
|
||||||
SendServerMessage(Loc.GetString("game-ticker-start-round"));
|
SendServerMessage(Loc.GetString("game-ticker-start-round"));
|
||||||
|
|
||||||
// Just in case it hasn't been loaded previously we'll try loading it.
|
|
||||||
LoadMaps();
|
|
||||||
|
|
||||||
// map has been selected so update the lobby info text
|
|
||||||
// applies to players who didn't ready up
|
|
||||||
UpdateInfoText();
|
|
||||||
|
|
||||||
StartGamePresetRules();
|
|
||||||
|
|
||||||
RoundLengthMetric.Set(0);
|
|
||||||
|
|
||||||
var startingEvent = new RoundStartingEvent(RoundId);
|
|
||||||
RaiseLocalEvent(startingEvent);
|
|
||||||
var readyPlayers = new List<ICommonSession>();
|
var readyPlayers = new List<ICommonSession>();
|
||||||
var readyPlayerProfiles = new Dictionary<NetUserId, HumanoidCharacterProfile>();
|
var readyPlayerProfiles = new Dictionary<NetUserId, HumanoidCharacterProfile>();
|
||||||
|
var autoDeAdmin = _cfg.GetCVar(CCVars.AdminDeadminOnJoin);
|
||||||
foreach (var (userId, status) in _playerGameStatuses)
|
foreach (var (userId, status) in _playerGameStatuses)
|
||||||
{
|
{
|
||||||
if (LobbyEnabled && status != PlayerGameStatus.ReadyToPlay) continue;
|
if (LobbyEnabled && status != PlayerGameStatus.ReadyToPlay) continue;
|
||||||
if (!_playerManager.TryGetSessionById(userId, out var session)) continue;
|
if (!_playerManager.TryGetSessionById(userId, out var session)) continue;
|
||||||
|
|
||||||
|
if (autoDeAdmin && _adminManager.IsAdmin(session))
|
||||||
|
{
|
||||||
|
_adminManager.DeAdmin(session);
|
||||||
|
}
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
DebugTools.Assert(_userDb.IsLoadComplete(session), $"Player was readied up but didn't have user DB data loaded yet??");
|
DebugTools.Assert(_userDb.IsLoadComplete(session), $"Player was readied up but didn't have user DB data loaded yet??");
|
||||||
#endif
|
#endif
|
||||||
@@ -235,6 +228,20 @@ namespace Content.Server.GameTicking
|
|||||||
readyPlayerProfiles.Add(userId, profile);
|
readyPlayerProfiles.Add(userId, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Just in case it hasn't been loaded previously we'll try loading it.
|
||||||
|
LoadMaps();
|
||||||
|
|
||||||
|
// map has been selected so update the lobby info text
|
||||||
|
// applies to players who didn't ready up
|
||||||
|
UpdateInfoText();
|
||||||
|
|
||||||
|
StartGamePresetRules();
|
||||||
|
|
||||||
|
RoundLengthMetric.Set(0);
|
||||||
|
|
||||||
|
var startingEvent = new RoundStartingEvent(RoundId);
|
||||||
|
RaiseLocalEvent(startingEvent);
|
||||||
|
|
||||||
var origReadyPlayers = readyPlayers.ToArray();
|
var origReadyPlayers = readyPlayers.ToArray();
|
||||||
|
|
||||||
if (!StartPreset(origReadyPlayers, force))
|
if (!StartPreset(origReadyPlayers, force))
|
||||||
|
|||||||
@@ -154,10 +154,6 @@ namespace Content.Server.GameTicking
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically de-admin players who are joining.
|
|
||||||
if (_cfg.GetCVar(CCVars.AdminDeadminOnJoin) && _adminManager.IsAdmin(player))
|
|
||||||
_adminManager.DeAdmin(player);
|
|
||||||
|
|
||||||
// We raise this event to allow other systems to handle spawning this player themselves. (e.g. late-join wizard, etc)
|
// We raise this event to allow other systems to handle spawning this player themselves. (e.g. late-join wizard, etc)
|
||||||
var bev = new PlayerBeforeSpawnEvent(player, character, jobId, lateJoin, station);
|
var bev = new PlayerBeforeSpawnEvent(player, character, jobId, lateJoin, station);
|
||||||
RaiseLocalEvent(bev);
|
RaiseLocalEvent(bev);
|
||||||
|
|||||||
@@ -763,10 +763,6 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
|
|||||||
_mind.SetUserId(newMind, nukieSession.Session.UserId);
|
_mind.SetUserId(newMind, nukieSession.Session.UserId);
|
||||||
_roles.MindAddRole(newMind, new NukeopsRoleComponent { PrototypeId = nukieSession.Type.AntagRoleProto });
|
_roles.MindAddRole(newMind, new NukeopsRoleComponent { PrototypeId = nukieSession.Type.AntagRoleProto });
|
||||||
|
|
||||||
// Automatically de-admin players who are being made nukeops
|
|
||||||
if (_cfg.GetCVar(CCVars.AdminDeadminOnJoin) && _adminManager.IsAdmin(nukieSession.Session))
|
|
||||||
_adminManager.DeAdmin(nukieSession.Session);
|
|
||||||
|
|
||||||
_mind.TransferTo(newMind, mob);
|
_mind.TransferTo(newMind, mob);
|
||||||
}
|
}
|
||||||
//Otherwise, spawn as a ghost role
|
//Otherwise, spawn as a ghost role
|
||||||
|
|||||||
Reference in New Issue
Block a user