Skip to content

Commit

Permalink
Update metastation & add new roundstart dock component for shuttles
Browse files Browse the repository at this point in the history
  • Loading branch information
MilenVolf committed Jan 8, 2025
1 parent 0dc9c88 commit 99f1f7f
Show file tree
Hide file tree
Showing 9 changed files with 2,369 additions and 824 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Content.Server.Starshine.Shuttles.Systems;
using Robust.Shared.Utility;

namespace Content.Server.Starshine.Shuttles.Components;

[RegisterComponent, Access(typeof(StationShuttleDock))]
public sealed partial class StationShuttleDockComponent : Component
{
[DataField]
public EntityUid Shuttle;

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

[DataField(required: true)]
public ResPath Path;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Content.Server.Starshine.Shuttles.Components;
using Content.Server.Station.Components;
using Content.Server.Station.Events;
using Robust.Server.GameObjects;
using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;

namespace Content.Server.Starshine.Shuttles.Systems;

/// <summary>
/// If enabled spawns players on a separate arrivals station before they can transfer to the main station.
/// </summary>
public sealed class StationShuttleDock : EntitySystem
{
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly MapLoaderSystem _loader = default!;
[Dependency] private readonly ShuttleSystem _shuttles = default!;

/// <summary>
/// The first arrival is a little early, to save everyone 10s
/// </summary>
private const float RoundStartFTLDuration = 10f;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<StationShuttleDockComponent, StationPostInitEvent>(OnStationPostInit);
}

private bool TryGetStation(out EntityUid uid)
{
var stationsQuery = EntityQueryEnumerator<BecomesStationComponent>();

while (stationsQuery.MoveNext(out uid, out _))
{
return true;
}

return false;
}

private void OnStationPostInit(EntityUid uid, StationShuttleDockComponent component, ref StationPostInitEvent args)
{
SetupShuttle(uid, component);
}

private void SetupShuttle(EntityUid uid, StationShuttleDockComponent component)
{
if (!Deleted(component.Shuttle))
return;

// Spawn shuttle on a dummy map then dock it to the source.
var dummpMapEntity = _mapSystem.CreateMap(out var dummyMapId);

if (TryGetStation(out var station) &&
_loader.TryLoad(dummyMapId, component.Path.ToString(), out var shuttleUids))
{
component.Shuttle = shuttleUids[0];
var shuttleComp = Comp<ShuttleComponent>(component.Shuttle);
_shuttles.FTLToDock(component.Shuttle, shuttleComp, station, hyperspaceTime: RoundStartFTLDuration, priorityTag: component.TargetTag);
}

// Don't start the arrivals shuttle immediately docked so power has a time to stabilise?
var timer = AddComp<TimedDespawnComponent>(dummpMapEntity);
timer.Lifetime = 15f;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ent-AirlockExternalGlassShuttlePilot = { ent-AirlockGlassShuttle }
.suffix = Внешний, Пилот, Шаттл, Стеклянный, Стыковочный
.desc = { ent-AirlockGlassShuttle.desc }
ent-AirlockExternalGlassShuttleSalvage = { ent-AirlockGlassShuttle }
.suffix = Внешний, Утилизатор, Шаттл, Стеклянный, Стыковочный
.desc = { ent-AirlockGlassShuttle.desc }
3,067 changes: 2,252 additions & 815 deletions Resources/Maps/metastation.yml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1394,11 +1394,3 @@
- type: ContainerFill
containers:
board: [ DoorElectronicsSyndicateAgent ]

- type: entity
parent: AirlockGlassShuttle
id: AirlockExternalGlassShuttlePilot
suffix: External, Shuttle Pilot, Glass, Docking
components:
- type: GridFill
path: /Maps/Shuttles/ferryman.yml
3 changes: 3 additions & 0 deletions Resources/Prototypes/Maps/metastation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
prefixCreator: 'TG'
- type: StationEmergencyShuttle
emergencyShuttlePath: /Maps/Shuttles/emergency_meta.yml
- type: StationShuttleDock
targetTag: SalvageShuttle
path: /Maps/Shuttles/beetle.yml
- type: StationJobs
overflowJobs:
- Passenger
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Starshine/Entities/Stations/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
- Bank
- Zoo
- MiningOutpost
- Tesla
- Tesla
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- type: entity
parent: AirlockGlassShuttle
id: AirlockExternalGlassShuttlePilot
suffix: External, Shuttle Pilot, Glass, Docking
components:
- type: GridFill
path: /Maps/Shuttles/ferryman.yml

- type: entity
parent: AirlockGlassShuttle
id: AirlockExternalGlassShuttleSalvage
suffix: Salvage, Glass, Docking
components:
- type: PriorityDock
tag: SalvageShuttle
- type: ContainerFill
containers:
board: [ DoorElectronicsSalvage ]
3 changes: 3 additions & 0 deletions Resources/Prototypes/Starshine/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
- type: Tag
id: PlushieSharkBlack

- type: Tag
id: SalvageShuttle

- type: Tag
id: Slime

Expand Down

0 comments on commit 99f1f7f

Please sign in to comment.