From bf1450fdc85f978c0d1b313fab551d85a98087a5 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 | 3 +-- .../StationEvents/Events/BreakerFlipRule.cs | 4 ++-- .../StationEvents/Events/IonStormRule.cs | 2 +- .../Events/PowerGridCheckRule.cs | 3 +-- .../StationEvents/Events/VentClogRule.cs | 9 ++++---- .../StationEvents/Events/VentCrittersRule.cs | 3 +-- .../EntitySystems/BluespaceLockerSystem.cs | 2 +- .../Components/StationMemberComponent.cs | 6 ++--- 18 files changed, 40 insertions(+), 28 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 d00e319eed..801a3f8fdf 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 cc5d99e8b2..0ccb5e314b 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 d1997c68ba..f991eabdbd 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 0384e06956..3de5d98a81 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 156088ea07..b6810aa33b 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 35b17dc958..a07d590461 100644 --- a/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs @@ -4,10 +4,10 @@ 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.GameTicking.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 6c7bb5c923..bdaa4a40bc 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 3af461beda..eb5e11b8eb 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 b4fcccd805..0976bc5de1 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 5930eef39b..5ddb0e7746 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 b19485bc31..0dd4e92477 100644 --- a/Content.Server/StationEvents/Events/BluespaceLockerRule.cs +++ b/Content.Server/StationEvents/Events/BluespaceLockerRule.cs @@ -1,10 +1,9 @@ -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; diff --git a/Content.Server/StationEvents/Events/BreakerFlipRule.cs b/Content.Server/StationEvents/Events/BreakerFlipRule.cs index 0cfe87051d..8a25d40abb 100644 --- a/Content.Server/StationEvents/Events/BreakerFlipRule.cs +++ b/Content.Server/StationEvents/Events/BreakerFlipRule.cs @@ -1,8 +1,8 @@ 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.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 926ecc2db9..b20b81822f 100644 --- a/Content.Server/StationEvents/Events/IonStormRule.cs +++ b/Content.Server/StationEvents/Events/IonStormRule.cs @@ -1,6 +1,5 @@ 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 e00369a321..a4594e1387 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.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 043ea0375a..f14958631d 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.Rules.Components; -using Content.Server.StationEvents.Components; -using Content.Shared.GameTicking.Components; namespace Content.Server.StationEvents.Events; diff --git a/Content.Server/StationEvents/Events/VentCrittersRule.cs b/Content.Server/StationEvents/Events/VentCrittersRule.cs index fba9cfa6a6..5ca5a9d215 100644 --- a/Content.Server/StationEvents/Events/VentCrittersRule.cs +++ b/Content.Server/StationEvents/Events/VentCrittersRule.cs @@ -1,7 +1,6 @@ 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 9da7606bcc..3754919c68 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 2100c20c55..ce5d95ad0d 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 { /// -- 2.51.2