Refactor stations to properly use entity prototypes. (stationsv3) (#16570)
* Update StationSpawningSystem.cs Web-edit to allow feeding in an existing entity. * Update StationSpawningSystem.cs value type moment * Update StationSpawningSystem.cs * Oh goddamnit this is a refactor now. * awawawa * aaaaaaaaaaa * ee * forgot records. * no records? no records. * What's in a name? * Sloth forcing me to do the refactor properly smh. * e * optional evac in test. * tests pls work * awa --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
using Content.Server.GameTicking;
|
||||
|
||||
namespace Content.Server.Station.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Added to grids saved in maps to designate them as 'part of a station' and not main grids. I.e. ancillary
|
||||
/// shuttles for multi-grid stations.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(GameTicker)), Obsolete("Performs the exact same function as BecomesStationComponent.")]
|
||||
public sealed class PartOfStationComponent : Component
|
||||
{
|
||||
[DataField("id", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Id = default!;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Server.Station.Systems;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Station.Components;
|
||||
|
||||
@@ -19,15 +21,6 @@ public sealed class StationDataComponent : Component
|
||||
/// <summary>
|
||||
/// List of all grids this station is part of.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You should not mutate this yourself, go through StationSystem so the appropriate events get fired.
|
||||
/// </remarks>
|
||||
[DataField("grids")]
|
||||
public readonly HashSet<EntityUid> Grids = new();
|
||||
|
||||
/// <summary>
|
||||
/// The emergency shuttle assigned to this station.
|
||||
/// </summary>
|
||||
[ViewVariables, Access(typeof(ShuttleSystem), typeof(EmergencyShuttleSystem), Friend = AccessPermissions.ReadWrite)]
|
||||
public EntityUid? EmergencyShuttle;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Content.Server.Station.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for event eligibility.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class StationEventEligibleComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -32,6 +32,16 @@ public sealed class StationJobsComponent : Component
|
||||
/// </summary>
|
||||
[DataField("extendedAccess")] public bool ExtendedAccess;
|
||||
|
||||
/// <summary>
|
||||
/// If there are less than or equal this amount of players in the game at round start,
|
||||
/// people get extended access levels from job prototypes.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Set to -1 to disable extended access.
|
||||
/// </remarks>
|
||||
[DataField("extendedAccessThreshold")]
|
||||
public int ExtendedAccessThreshold { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// The percentage of jobs remaining.
|
||||
/// </summary>
|
||||
@@ -62,5 +72,10 @@ public sealed class StationJobsComponent : Component
|
||||
/// <summary>
|
||||
/// Overflow jobs that round-start can spawn infinitely many of.
|
||||
/// </summary>
|
||||
[DataField("overflowJobs", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<JobPrototype>))] public HashSet<string> OverflowJobs = new();
|
||||
[DataField("overflowJobs", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<JobPrototype>))]
|
||||
public HashSet<string> OverflowJobs = new();
|
||||
|
||||
[DataField("availableJobs", required: true,
|
||||
customTypeSerializer: typeof(PrototypeIdDictionarySerializer<List<int?>, JobPrototype>))]
|
||||
public readonly Dictionary<string, List<int?>> SetupAvailableJobs = default!;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using Content.Server.Maps.NameGenerators;
|
||||
|
||||
namespace Content.Server.Station.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for setting up a station's name.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class StationNameSetupComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The name template to use for the station.
|
||||
/// If there's a name generator this should follow it's required format.
|
||||
/// </summary>
|
||||
[DataField("mapNameTemplate", required: true)]
|
||||
public string StationNameTemplate { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Name generator to use for the station, if any.
|
||||
/// </summary>
|
||||
[DataField("nameGenerator")]
|
||||
public StationNameGenerator? NameGenerator { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user