From 820935fd85c15dd3ab255148b5ed4287c2987b52 Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Mon, 22 Jul 2024 21:32:30 +0200 Subject: [PATCH] Fix replayghost spawning location (#30252) Fix replayghost spawn --- .../ReplaySpectatorSystem.Position.cs | 22 ++++++++++++++----- .../Tests/GameRules/NukeOpsTest.cs | 1 + .../Tests/PostMapInitTest.cs | 1 + .../Converters/EntityCoordinatesConverter.cs | 2 +- .../EntitySystems/EmergencyLightSystem.cs | 2 +- .../PowerMonitoringConsoleSystem.cs | 2 +- .../Respawn/SpecialRespawnSystem.cs | 2 +- .../Systems/ShuttleConsoleSystem.Drone.cs | 2 +- .../Systems/ShuttleSystem.GridFill.cs | 1 + .../Station/Systems/StationSystem.cs | 1 + .../Events/BluespaceLockerRule.cs | 5 ++--- .../StationEvents/Events/BreakerFlipRule.cs | 3 ++- .../StationEvents/Events/IonStormRule.cs | 2 +- .../Events/PowerGridCheckRule.cs | 5 ++--- .../StationEvents/Events/VentClogRule.cs | 9 ++++---- .../StationEvents/Events/VentCrittersRule.cs | 4 ++-- .../EntitySystems/BluespaceLockerSystem.cs | 2 +- .../Components/StationMemberComponent.cs | 6 ++--- 18 files changed, 43 insertions(+), 29 deletions(-) rename {Content.Server => Content.Shared}/Station/Components/StationMemberComponent.cs (69%) diff --git a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs index d00e319eed9..801a3f8fdfb 100644 --- a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs +++ b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs @@ -1,4 +1,5 @@ using Content.Shared.Movement.Components; +using Content.Shared.Station.Components; using Robust.Shared.GameStates; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -164,14 +165,25 @@ public sealed partial class ReplaySpectatorSystem float? maxSize = null; var gridQuery = EntityQueryEnumerator(); + var stationFound = false; while (gridQuery.MoveNext(out var uid, out var grid)) { var size = grid.LocalAABB.Size.LengthSquared(); - if (maxSize == null || size > maxSize) - { - maxUid = (uid, grid); - maxSize = size; - } + + if (maxSize is not null && size < maxSize) + continue; + + var station = HasComp(uid); + + if (!station && stationFound) + continue; + + maxUid = (uid, grid); + maxSize = size; + + if (station) + stationFound = true; + } coords = new EntityCoordinates(maxUid ?? default, default); diff --git a/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs b/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs index cc5d99e8b2f..0ccb5e314b9 100644 --- a/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs +++ b/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs @@ -18,6 +18,7 @@ using Content.Shared.Hands.Components; using Content.Shared.Inventory; using Content.Shared.NPC.Systems; using Content.Shared.NukeOps; +using Content.Shared.Station.Components; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.Map.Components; diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index f90425a52e5..f529c0e5f5d 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -16,6 +16,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Prototypes; +using Content.Shared.Station.Components; using Robust.Shared.Utility; using YamlDotNet.RepresentationModel; diff --git a/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs b/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs index 0384e069561..3de5d98a81a 100644 --- a/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs +++ b/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs @@ -1,5 +1,5 @@ using System.Text.Json; -using Content.Server.Station.Components; +using Content.Shared.Station.Components; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs b/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs index 156088ea072..b6810aa33be 100644 --- a/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs +++ b/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs @@ -3,11 +3,11 @@ using Content.Server.Audio; using Content.Server.Light.Components; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; -using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Shared.Examine; using Content.Shared.Light; using Content.Shared.Light.Components; +using Content.Shared.Station.Components; using Robust.Server.GameObjects; using Color = Robust.Shared.Maths.Color; diff --git a/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs b/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs index 13e27559835..9540834b81b 100644 --- a/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs @@ -4,9 +4,9 @@ using Content.Server.NodeContainer.Nodes; using Content.Server.Power.Components; using Content.Server.Power.Nodes; using Content.Server.Power.NodeGroups; -using Content.Server.Station.Components; using Content.Server.StationEvents.Components; using Content.Shared.Pinpointer; +using Content.Shared.Station.Components; using Content.Shared.Power; using JetBrains.Annotations; using Robust.Server.GameObjects; diff --git a/Content.Server/Respawn/SpecialRespawnSystem.cs b/Content.Server/Respawn/SpecialRespawnSystem.cs index 6c7bb5c9234..bdaa4a40bc1 100644 --- a/Content.Server/Respawn/SpecialRespawnSystem.cs +++ b/Content.Server/Respawn/SpecialRespawnSystem.cs @@ -2,7 +2,7 @@ using Content.Server.Atmos.EntitySystems; using Content.Server.Chat.Managers; using Content.Server.GameTicking; -using Content.Server.Station.Components; +using Content.Shared.Station.Components; using Content.Server.Station.Systems; using Content.Shared.Database; using Content.Shared.Maps; diff --git a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.Drone.cs b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.Drone.cs index 3af461bedac..eb5e11b8ebe 100644 --- a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.Drone.cs +++ b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.Drone.cs @@ -1,6 +1,6 @@ using Content.Server.Shuttles.Components; using Content.Server.Shuttles.Events; -using Content.Server.Station.Components; +using Content.Shared.Station.Components; using Content.Shared.UserInterface; namespace Content.Server.Shuttles.Systems; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs index b4fcccd8055..0976bc5de1c 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs @@ -7,6 +7,7 @@ using Content.Shared.CCVar; using Content.Shared.Procedural; using Content.Shared.Salvage; using Content.Shared.Shuttles.Components; +using Content.Shared.Station.Components; using Robust.Shared.Collections; using Robust.Shared.Map; using Robust.Shared.Random; diff --git a/Content.Server/Station/Systems/StationSystem.cs b/Content.Server/Station/Systems/StationSystem.cs index 5930eef39bd..5ddb0e7746b 100644 --- a/Content.Server/Station/Systems/StationSystem.cs +++ b/Content.Server/Station/Systems/StationSystem.cs @@ -5,6 +5,7 @@ using Content.Server.Station.Components; using Content.Server.Station.Events; using Content.Shared.CCVar; using Content.Shared.Station; +using Content.Shared.Station.Components; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Server.Player; diff --git a/Content.Server/StationEvents/Events/BluespaceLockerRule.cs b/Content.Server/StationEvents/Events/BluespaceLockerRule.cs index eef9850e739..0dd4e924770 100644 --- a/Content.Server/StationEvents/Events/BluespaceLockerRule.cs +++ b/Content.Server/StationEvents/Events/BluespaceLockerRule.cs @@ -1,11 +1,10 @@ -using Content.Server.GameTicking.Components; -using Content.Server.GameTicking.Rules.Components; using Content.Server.Resist; -using Content.Server.Station.Components; using Content.Server.StationEvents.Components; using Content.Server.Storage.Components; using Content.Server.Storage.EntitySystems; using Content.Shared.Access.Components; +using Content.Shared.Station.Components; +using Content.Shared.GameTicking.Components; using Content.Shared.Coordinates; namespace Content.Server.StationEvents.Events; diff --git a/Content.Server/StationEvents/Events/BreakerFlipRule.cs b/Content.Server/StationEvents/Events/BreakerFlipRule.cs index 16d3fd8c95d..1b4a1dd9a3f 100644 --- a/Content.Server/StationEvents/Events/BreakerFlipRule.cs +++ b/Content.Server/StationEvents/Events/BreakerFlipRule.cs @@ -2,8 +2,9 @@ using Content.Server.GameTicking.Rules.Components; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; -using Content.Server.Station.Components; using Content.Server.StationEvents.Components; +using Content.Shared.GameTicking.Components; +using Content.Shared.Station.Components; using JetBrains.Annotations; namespace Content.Server.StationEvents.Events; diff --git a/Content.Server/StationEvents/Events/IonStormRule.cs b/Content.Server/StationEvents/Events/IonStormRule.cs index 8361cc6048a..bfdeb7a867d 100644 --- a/Content.Server/StationEvents/Events/IonStormRule.cs +++ b/Content.Server/StationEvents/Events/IonStormRule.cs @@ -1,7 +1,6 @@ using Content.Server.GameTicking.Components; using System.Linq; using Content.Server.Silicons.Laws; -using Content.Server.Station.Components; using Content.Server.StationEvents.Components; using Content.Shared.Administration.Logs; using Content.Shared.Database; @@ -11,6 +10,7 @@ using Content.Shared.Random; using Content.Shared.Random.Helpers; using Content.Shared.Silicons.Laws; using Content.Shared.Silicons.Laws.Components; +using Content.Shared.Station.Components; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/StationEvents/Events/PowerGridCheckRule.cs b/Content.Server/StationEvents/Events/PowerGridCheckRule.cs index d547fc94461..a4594e13879 100644 --- a/Content.Server/StationEvents/Events/PowerGridCheckRule.cs +++ b/Content.Server/StationEvents/Events/PowerGridCheckRule.cs @@ -1,10 +1,9 @@ using System.Threading; -using Content.Server.GameTicking.Components; -using Content.Server.GameTicking.Rules.Components; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; -using Content.Server.Station.Components; using Content.Server.StationEvents.Components; +using Content.Shared.GameTicking.Components; +using Content.Shared.Station.Components; using JetBrains.Annotations; using Robust.Shared.Audio; using Robust.Shared.Player; diff --git a/Content.Server/StationEvents/Events/VentClogRule.cs b/Content.Server/StationEvents/Events/VentClogRule.cs index 867f41dcccf..f14958631d1 100644 --- a/Content.Server/StationEvents/Events/VentClogRule.cs +++ b/Content.Server/StationEvents/Events/VentClogRule.cs @@ -1,14 +1,13 @@ using Content.Server.Atmos.Piping.Unary.Components; -using Content.Server.Station.Components; +using Content.Server.Fluids.EntitySystems; +using Content.Server.StationEvents.Components; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; +using Content.Shared.GameTicking.Components; +using Content.Shared.Station.Components; using JetBrains.Annotations; using Robust.Shared.Random; using System.Linq; -using Content.Server.Fluids.EntitySystems; -using Content.Server.GameTicking.Components; -using Content.Server.GameTicking.Rules.Components; -using Content.Server.StationEvents.Components; namespace Content.Server.StationEvents.Events; diff --git a/Content.Server/StationEvents/Events/VentCrittersRule.cs b/Content.Server/StationEvents/Events/VentCrittersRule.cs index c2605039bce..6d69e522f09 100644 --- a/Content.Server/StationEvents/Events/VentCrittersRule.cs +++ b/Content.Server/StationEvents/Events/VentCrittersRule.cs @@ -1,7 +1,7 @@ using Content.Server.GameTicking.Components; using Content.Server.StationEvents.Components; -using Content.Server.GameTicking.Rules.Components; -using Content.Server.Station.Components; +using Content.Shared.GameTicking.Components; +using Content.Shared.Station.Components; using Content.Shared.Storage; using Robust.Shared.Map; using Robust.Shared.Random; diff --git a/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs b/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs index 9da7606bcc5..3754919c689 100644 --- a/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs +++ b/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs @@ -1,7 +1,6 @@ using System.Linq; using Content.Server.Explosion.EntitySystems; using Content.Server.Resist; -using Content.Server.Station.Components; using Content.Server.Storage.Components; using Content.Shared.Access; using Content.Shared.Access.Components; @@ -9,6 +8,7 @@ using Content.Shared.Coordinates; using Content.Shared.DoAfter; using Content.Shared.Lock; using Content.Shared.Mind.Components; +using Content.Shared.Station.Components; using Content.Shared.Storage.Components; using Content.Shared.Storage.EntitySystems; using Content.Shared.Tools.Systems; diff --git a/Content.Server/Station/Components/StationMemberComponent.cs b/Content.Shared/Station/Components/StationMemberComponent.cs similarity index 69% rename from Content.Server/Station/Components/StationMemberComponent.cs rename to Content.Shared/Station/Components/StationMemberComponent.cs index 2100c20c55d..ce5d95ad0d2 100644 --- a/Content.Server/Station/Components/StationMemberComponent.cs +++ b/Content.Shared/Station/Components/StationMemberComponent.cs @@ -1,11 +1,11 @@ -using Content.Server.Station.Systems; +using Robust.Shared.GameStates; -namespace Content.Server.Station.Components; +namespace Content.Shared.Station.Components; /// /// Indicates that a grid is a member of the given station. /// -[RegisterComponent, Access(typeof(StationSystem))] +[RegisterComponent, NetworkedComponent] public sealed partial class StationMemberComponent : Component { ///