using Content.Server.GameTicking.Events;
using Content.Server.Ghost;
using Content.Server.Maps;
+using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Mind;
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 readyPlayerProfiles = new Dictionary<NetUserId, HumanoidCharacterProfile>();
-
+ var autoDeAdmin = _cfg.GetCVar(CCVars.AdminDeadminOnJoin);
foreach (var (userId, status) in _playerGameStatuses)
{
if (LobbyEnabled && status != PlayerGameStatus.ReadyToPlay) continue;
if (!_playerManager.TryGetSessionById(userId, out var session)) continue;
+
+ if (autoDeAdmin && _adminManager.IsAdmin(session))
+ {
+ _adminManager.DeAdmin(session);
+ }
#if DEBUG
DebugTools.Assert(_userDb.IsLoadComplete(session), $"Player was readied up but didn't have user DB data loaded yet??");
#endif
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();
if (!StartPreset(origReadyPlayers, force))
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)
var bev = new PlayerBeforeSpawnEvent(player, character, jobId, lateJoin, station);
RaiseLocalEvent(bev);
_mind.SetUserId(newMind, nukieSession.Session.UserId);
_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);
}
//Otherwise, spawn as a ghost role