diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 98794c9926..dbd029be84 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -7,7 +7,6 @@ using Content.Shared.GameTicking; using Content.Shared.Preferences; using JetBrains.Annotations; using Prometheus; -using Robust.Server.GameStates; using Robust.Server.Maps; using Robust.Server.Player; using Robust.Shared.Audio; @@ -46,22 +45,6 @@ namespace Content.Server.GameTicking [ViewVariables] private bool _startingRound; - /// - /// This is a list of players that are going to appear in the round-end - /// crew manifest so their children entities can be collected each update - /// and sent to far-away players. - /// - [ViewVariables] - private HashSet _expandPvsPlayers = new(); - - /// - /// This is the list of the children entities that should be sent to - /// all players at the end of the round, to keep distant characters from - /// looking naked in the crew manifest. - /// - [ViewVariables] - private HashSet _expandPvsEntities = new(); - [ViewVariables] private GameRunLevel _runLevel; @@ -81,16 +64,6 @@ namespace Content.Server.GameTicking } } - private void InitializeRoundFlow() - { - SubscribeLocalEvent(OnExpandPvs); - } - - private void OnEntityDeleted(EntityUid uid) - { - _expandPvsEntities.Remove(uid); - } - /// /// Returns true if the round's map is eligible to be updated. /// @@ -332,14 +305,6 @@ namespace Content.Server.GameTicking ShowRoundEndScoreboard(text); } - private void OnExpandPvs(ref ExpandPvsEvent args) - { - if (RunLevel != GameRunLevel.PostRound) - return; - - args.Entities.AddRange(_expandPvsEntities); - } - public void ShowRoundEndScoreboard(string text = "") { // Log end of round @@ -357,11 +322,6 @@ namespace Content.Server.GameTicking //Get the timespan of the round. var roundDuration = RoundDuration(); - // Should already be empty, but just in case. - _expandPvsEntities.Clear(); - _expandPvsPlayers.Clear(); - EntityManager.EntityDeleted += OnEntityDeleted; - //Generate a list of basic player info to display in the end round summary. var listOfPlayerInfo = new List(); // Grab the great big book of all the Minds, we'll need them for this. @@ -395,8 +355,9 @@ namespace Content.Server.GameTicking else if (mind.CurrentEntity != null && TryName(mind.CurrentEntity.Value, out var icName)) playerIcName = icName; - if (Exists(mind.OriginalOwnedEntity)) - _expandPvsPlayers.Add(mind.OriginalOwnedEntity.Value); + var entity = mind.OriginalOwnedEntity; + if (Exists(entity)) + _pvsOverride.AddGlobalOverride(entity.Value, recursive: true); var playerEndRoundInfo = new RoundEndMessageEvent.RoundEndPlayerInfo() { @@ -405,7 +366,7 @@ namespace Content.Server.GameTicking PlayerOOCName = contentPlayerData?.Name ?? "(IMPOSSIBLE: REGISTERED MIND WITH NO OWNER)", // Character name takes precedence over current entity name PlayerICName = playerIcName, - PlayerEntityUid = mind.OriginalOwnedEntity, + PlayerEntityUid = entity, Role = antag ? mind.AllRoles.First(role => role.Antagonist).Name : mind.AllRoles.FirstOrDefault()?.Name ?? Loc.GetString("game-ticker-unknown-role"), @@ -416,20 +377,6 @@ namespace Content.Server.GameTicking listOfPlayerInfo.Add(playerEndRoundInfo); } - // Recursively collect entities for the crew manifest. - void RecursePvsEntities(IEnumerable entities) - { - _expandPvsEntities.UnionWith(entities); - - foreach (var entity in entities) - { - if (TryComp(entity, out var xform)) - RecursePvsEntities(xform.ChildEntities); - } - } - - RecursePvsEntities(_expandPvsPlayers); - // This ordering mechanism isn't great (no ordering of minds) but functions var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray(); @@ -527,10 +474,6 @@ namespace Content.Server.GameTicking _allPreviousGameRules.Clear(); - EntityManager.EntityDeleted -= OnEntityDeleted; - _expandPvsPlayers.Clear(); - _expandPvsEntities.Clear(); - // Round restart cleanup event, so entity systems can reset. var ev = new RoundRestartCleanupEvent(); RaiseLocalEvent(ev); diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index fbe40ee6d6..d62fb2ac60 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -18,6 +18,7 @@ using Content.Shared.Mobs.Systems; using Content.Shared.Roles; using Robust.Server; using Robust.Server.GameObjects; +using Robust.Server.GameStates; using Robust.Shared.Configuration; using Robust.Shared.Console; #if EXCEPTION_TOLERANCE @@ -40,6 +41,7 @@ namespace Content.Server.GameTicking [Dependency] private readonly MindSystem _mind = default!; [Dependency] private readonly MindTrackerSystem _mindTracker = default!; [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly PvsOverrideSystem _pvsOverride = default!; [Dependency] private readonly IAdminLogManager _adminLogs = default!; [ViewVariables] private bool _initialized; @@ -70,7 +72,6 @@ namespace Content.Server.GameTicking "Overflow role does not have the correct name!"); InitializeGameRules(); InitializeReplays(); - InitializeRoundFlow(); _initialized = true; }