Cargo shuttle fixes (#17118)

This commit is contained in:
metalgearsloth
2023-06-05 13:37:00 +10:00
committed by GitHub
parent 265285a030
commit 7d178555e1
2 changed files with 20 additions and 9 deletions

View File

@@ -1,9 +1,7 @@
using System.Linq; using System.Linq;
using Content.Server.Cargo.Components; using Content.Server.Cargo.Components;
using Content.Server.Shuttle.Components;
using Content.Server.Shuttles.Components; using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events; using Content.Server.Shuttles.Events;
using Content.Server.UserInterface;
using Content.Server.Shuttles.Systems; using Content.Server.Shuttles.Systems;
using Content.Server.Stack; using Content.Server.Stack;
using Content.Shared.Stacks; using Content.Shared.Stacks;
@@ -11,12 +9,9 @@ using Content.Shared.Cargo;
using Content.Shared.Cargo.BUI; using Content.Shared.Cargo.BUI;
using Content.Shared.Cargo.Components; using Content.Shared.Cargo.Components;
using Content.Shared.Cargo.Events; using Content.Shared.Cargo.Events;
using Content.Shared.Cargo.Prototypes;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Dataset;
using Content.Shared.GameTicking; using Content.Shared.GameTicking;
using Content.Shared.Whitelist; using Content.Shared.Whitelist;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Random; using Robust.Shared.Random;
@@ -35,6 +30,7 @@ public sealed partial class CargoSystem
*/ */
[Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@@ -57,6 +53,20 @@ public sealed partial class CargoSystem
SubscribeLocalEvent<CargoPalletConsoleComponent, BoundUIOpenedEvent>(OnPalletUIOpen); SubscribeLocalEvent<CargoPalletConsoleComponent, BoundUIOpenedEvent>(OnPalletUIOpen);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart); SubscribeLocalEvent<RoundRestartCleanupEvent>(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) private void OnCargoFTLTag(EntityUid uid, CargoShuttleComponent component, ref FTLTagEvent args)
@@ -368,6 +378,8 @@ public sealed partial class CargoSystem
private void OnRoundRestart(RoundRestartCleanupEvent ev) private void OnRoundRestart(RoundRestartCleanupEvent ev)
{ {
CleanupCargoShuttle(); CleanupCargoShuttle();
if (_cfgManager.GetCVar(CCVars.GridFill))
SetupCargoShuttle(); SetupCargoShuttle();
} }
@@ -388,12 +400,11 @@ public sealed partial class CargoSystem
while (query.MoveNext(out var uid, out var comp)) while (query.MoveNext(out var uid, out var comp))
{ {
var stationUid = _station.GetOwningStation(uid);
if (TryComp<StationCargoOrderDatabaseComponent>(uid, out var station)) if (TryComp<StationCargoOrderDatabaseComponent>(uid, out var station))
{ {
station.Shuttle = null; station.Shuttle = null;
} }
QueueDel(uid); QueueDel(uid);
} }
} }

View File

@@ -366,7 +366,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
if (comp == centcomm || comp.MapId != centcomm.MapId) if (comp == centcomm || comp.MapId != centcomm.MapId)
continue; continue;
comp.ShuttleIndex = comp.ShuttleIndex; comp.ShuttleIndex = centcomm.ShuttleIndex;
} }
component.EmergencyShuttle = shuttle; component.EmergencyShuttle = shuttle;