Skip to content

Commit

Permalink
fix mining shuttle not docking on small stations (#2430)
Browse files Browse the repository at this point in the history
fix bug and add log

Co-authored-by: deltanedas <@deltanedas:kde.org>
  • Loading branch information
deltanedas authored Dec 12, 2024
1 parent fbbb2ad commit 019cc24
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Content.Server/DeltaV/Shuttles/Systems/DockingConsoleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Shuttles.Systems;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.DeltaV.Shuttles;
using Content.Shared.DeltaV.Shuttles.Components;
using Content.Shared.DeltaV.Shuttles.Systems;
Expand All @@ -16,8 +18,10 @@ namespace Content.Server.DeltaV.Shuttles.Systems;
public sealed class DockingConsoleSystem : SharedDockingConsoleSystem
{
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
[Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;
[Dependency] private readonly ShuttleSystem _shuttle = default!;
[Dependency] private readonly StationSystem _station = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -114,6 +118,8 @@ private void OnFTL(Entity<DockingConsoleComponent> ent, ref DockingConsoleFTLMes
if (FindLargestGrid(map) is not {} grid)
return;

Log.Debug($"{ToPrettyString(args.Actor):user} is FTL-docking {ToPrettyString(shuttle):shuttle} to {ToPrettyString(grid):grid}");

_shuttle.FTLToDock(shuttle, Comp<ShuttleComponent>(shuttle), grid, priorityTag: ent.Comp.DockTag);
}

Expand All @@ -122,6 +128,12 @@ private void OnFTL(Entity<DockingConsoleComponent> ent, ref DockingConsoleFTLMes
EntityUid? largestGrid = null;
var largestSize = 0f;

if (TryComp<StationDataComponent>(_map.GetMap(map), out var station))
{
// prevent picking vgroid and stuff
return _station.GetLargestGrid(station);
}

var query = EntityQueryEnumerator<MapGridComponent, TransformComponent>();
while (query.MoveNext(out var gridUid, out var grid, out var xform))
{
Expand Down

0 comments on commit 019cc24

Please sign in to comment.