diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index b819154a41..e674868df3 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -221,9 +221,10 @@ namespace Content.IntegrationTests.Tests // Test shuttle can dock. // This is done inside gamemap test because loading the map takes ages and we already have it. var station = entManager.GetComponent(targetGrid!.Value).Station; - var shuttlePath = entManager.GetComponent(station).EmergencyShuttlePath - .ToString(); - var shuttle = mapLoader.LoadGrid(shuttleMap, entManager.GetComponent(station).EmergencyShuttlePath.ToString()); + var stationConfig = entManager.GetComponent(station).StationConfig; + Assert.IsNotNull(stationConfig, $"{entManager.ToPrettyString(station)} had null StationConfig."); + var shuttlePath = stationConfig.EmergencyShuttlePath.ToString(); + var shuttle = mapLoader.LoadGrid(shuttleMap, shuttlePath); Assert.That(shuttle != null && shuttleSystem.TryFTLDock(entManager.GetComponent(shuttle.Value), targetGrid.Value), $"Unable to dock {shuttlePath} to {mapProto}"); mapManager.DeleteMap(shuttleMap); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs index f864472aff..c9bf2d243e 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyShuttle.cs @@ -426,10 +426,17 @@ public sealed partial class ShuttleSystem private void AddEmergencyShuttle(StationDataComponent component) { - if (!_emergencyShuttleEnabled || CentComMap == null || component.EmergencyShuttle != null) return; + if (!_emergencyShuttleEnabled + || CentComMap == null + || component.EmergencyShuttle != null + || component.StationConfig == null) + { + return; + } // Load escape shuttle - var shuttle = _map.LoadGrid(CentComMap.Value, component.EmergencyShuttlePath.ToString(), new MapLoadOptions() + var shuttlePath = component.StationConfig.EmergencyShuttlePath; + var shuttle = _map.LoadGrid(CentComMap.Value, shuttlePath.ToString(), new MapLoadOptions() { // Should be far enough... right? I'm too lazy to bounds check CentCom rn. Offset = new Vector2(500f + _shuttleIndex, 0f) @@ -437,7 +444,7 @@ public sealed partial class ShuttleSystem if (shuttle == null) { - _sawmill.Error($"Unable to spawn emergency shuttle {component.EmergencyShuttlePath} for {ToPrettyString(component.Owner)}"); + _sawmill.Error($"Unable to spawn emergency shuttle {shuttlePath} for {ToPrettyString(component.Owner)}"); return; } diff --git a/Content.Server/Station/Components/StationDataComponent.cs b/Content.Server/Station/Components/StationDataComponent.cs index aa03059ac0..6c87f95494 100644 --- a/Content.Server/Station/Components/StationDataComponent.cs +++ b/Content.Server/Station/Components/StationDataComponent.cs @@ -1,6 +1,5 @@ using Content.Server.Shuttles.Systems; using Content.Server.Station.Systems; -using Robust.Shared.Utility; namespace Content.Server.Station.Components; @@ -31,10 +30,4 @@ public sealed class StationDataComponent : Component /// [ViewVariables, Access(typeof(ShuttleSystem), Friend = AccessPermissions.ReadWrite)] public EntityUid? EmergencyShuttle; - - /// - /// Emergency shuttle map path for this station. - /// - [ViewVariables(VVAccess.ReadWrite), Access(typeof(ShuttleSystem), Other = AccessPermissions.ReadWriteExecute)] - public ResourcePath EmergencyShuttlePath = new("/Maps/Shuttles/emergency.yml"); } diff --git a/Content.Server/Station/StationConfig.Shuttles.cs b/Content.Server/Station/StationConfig.Shuttles.cs new file mode 100644 index 0000000000..7c97bb295c --- /dev/null +++ b/Content.Server/Station/StationConfig.Shuttles.cs @@ -0,0 +1,13 @@ +using Robust.Shared.Utility; +using Robust.Shared.Serialization.TypeSerializers.Implementations; + +namespace Content.Server.Station; + +public sealed partial class StationConfig +{ + /// + /// Emergency shuttle map path for this station. + /// + [DataField("emergencyShuttlePath", customTypeSerializer: typeof(ResourcePathSerializer))] + public ResourcePath EmergencyShuttlePath { get; set; } = new("/Maps/Shuttles/emergency.yml"); +}