Fix cargo shuttle (#10397)

This commit is contained in:
metalgearsloth
2022-08-08 09:22:46 +10:00
committed by GitHub
parent ee969c9799
commit 797a11a6ed
3 changed files with 36 additions and 26 deletions

View File

@@ -6,6 +6,7 @@ using Content.Server.Shuttles.Events;
using Content.Server.UserInterface;
using Content.Server.Paper;
using Content.Server.Shuttles.Systems;
using Content.Server.Station.Components;
using Content.Shared.Cargo;
using Content.Shared.Cargo.BUI;
using Content.Shared.Cargo.Components;
@@ -358,13 +359,22 @@ public sealed partial class CargoSystem
/// </summary>
public void CallShuttle(StationCargoOrderDatabaseComponent orderDatabase)
{
if (!TryComp<CargoShuttleComponent>(orderDatabase.Shuttle, out var shuttle) ||
!TryComp<TransformComponent>(orderDatabase.Owner, out var xform)) return;
if (!TryComp<CargoShuttleComponent>(orderDatabase.Shuttle, out var shuttle))
return;
// Already called / not available
if (shuttle.NextCall == null || _timing.CurTime < shuttle.NextCall)
return;
if (!TryComp<StationDataComponent>(orderDatabase.Owner, out var stationData))
return;
var targetGrid = _station.GetLargestGrid(stationData);
// Nowhere to warp in to.
if (!TryComp<TransformComponent>(targetGrid, out var xform))
return;
shuttle.NextCall = null;
// Find a valid free area nearby to spawn in on