From 7d178555e126fea491cbe61f88c5300734511121 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 5 Jun 2023 13:37:00 +1000 Subject: [PATCH] Cargo shuttle fixes (#17118) --- .../Cargo/Systems/CargoSystem.Shuttle.cs | 27 +++++++++++++------ .../Systems/EmergencyShuttleSystem.cs | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs index 9226627d4a..3c272b4990 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs @@ -1,9 +1,7 @@ using System.Linq; using Content.Server.Cargo.Components; -using Content.Server.Shuttle.Components; using Content.Server.Shuttles.Components; using Content.Server.Shuttles.Events; -using Content.Server.UserInterface; using Content.Server.Shuttles.Systems; using Content.Server.Stack; using Content.Shared.Stacks; @@ -11,12 +9,9 @@ using Content.Shared.Cargo; using Content.Shared.Cargo.BUI; using Content.Shared.Cargo.Components; using Content.Shared.Cargo.Events; -using Content.Shared.Cargo.Prototypes; using Content.Shared.CCVar; -using Content.Shared.Dataset; using Content.Shared.GameTicking; using Content.Shared.Whitelist; -using Robust.Server.GameObjects; using Robust.Shared.Configuration; using Robust.Shared.Map; using Robust.Shared.Random; @@ -35,6 +30,7 @@ public sealed partial class CargoSystem */ [Dependency] private readonly IComponentFactory _factory = default!; + [Dependency] private readonly IConfigurationManager _cfgManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; @@ -57,6 +53,20 @@ public sealed partial class CargoSystem SubscribeLocalEvent(OnPalletUIOpen); SubscribeLocalEvent(OnRoundRestart); + _cfgManager.OnValueChanged(CCVars.GridFill, SetGridFill); + } + + private void ShutdownShuttle() + { + _cfgManager.UnsubValueChanged(CCVars.GridFill, SetGridFill); + } + + private void SetGridFill(bool obj) + { + if (obj) + { + SetupCargoShuttle(); + } } private void OnCargoFTLTag(EntityUid uid, CargoShuttleComponent component, ref FTLTagEvent args) @@ -368,7 +378,9 @@ public sealed partial class CargoSystem private void OnRoundRestart(RoundRestartCleanupEvent ev) { CleanupCargoShuttle(); - SetupCargoShuttle(); + + if (_cfgManager.GetCVar(CCVars.GridFill)) + SetupCargoShuttle(); } private void CleanupCargoShuttle() @@ -388,12 +400,11 @@ public sealed partial class CargoSystem while (query.MoveNext(out var uid, out var comp)) { - var stationUid = _station.GetOwningStation(uid); - if (TryComp(uid, out var station)) { station.Shuttle = null; } + QueueDel(uid); } } diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 4062f8cd40..5a14a30c5e 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -366,7 +366,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem if (comp == centcomm || comp.MapId != centcomm.MapId) continue; - comp.ShuttleIndex = comp.ShuttleIndex; + comp.ShuttleIndex = centcomm.ShuttleIndex; } component.EmergencyShuttle = shuttle;