Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Content.Server/_Sunrise/GridDock/GridDockSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Random; // Lust-add

namespace Content.Server._Sunrise.GridDock;

Expand All @@ -19,6 +20,7 @@ public sealed class GridDockSystem : EntitySystem
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly DockingSystem _dockSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly IRobustRandom _random = default!; // Lust-add

public override void Initialize()
{
Expand Down Expand Up @@ -48,10 +50,12 @@ private void OnStationPostInit(EntityUid uid, SpawnGridAndDockToStationComponent
var usedGridDocks = new HashSet<EntityUid>();
foreach (var entry in component.Grids)
{
if (!_loader.TryLoadGrid(xformMap.MapID,
entry.GridPath,
out var rootUid))
continue;
// Lust-start
var path = entry.PickPath(_random);

if (!_loader.TryLoadGrid(xformMap.MapID, path, out var rootUid))
continue;
// Lust-end

var grid = Comp<MapGridComponent>(rootUid.Value.Owner);
var width = grid.LocalAABB.Width;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Robust.Shared.Utility;
using Robust.Shared.Random; // Lust-add

namespace Content.Server._Sunrise.GridDock;

Expand All @@ -12,9 +13,24 @@ public sealed partial class SpawnGridAndDockToStationComponent : Component
[DataDefinition]
public sealed partial class GridDockEntry
{
[DataField(required: true)]
public ResPath GridPath;
// Lust-start
[DataField]
public ResPath? GridPath;

[DataField]
public List<ResPath> GridPaths = new();
// Lust-end

[DataField(required: true)]
public string PriorityTag;

// Lust-start
public ResPath PickPath(IRobustRandom random)
{
if (GridPaths.Count > 0)
return random.Pick(GridPaths);

return GridPath ?? ResPath.Empty;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// Lust-end
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
Loading