using Content.Server.Station.Systems; using Content.Shared.Roles; using JetBrains.Annotations; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; namespace Content.Server.Station.Components; /// /// Stores information about a station's job selection. /// [RegisterComponent, Access(typeof(StationJobsSystem)), PublicAPI] public sealed class StationJobsComponent : Component { /// /// Total *round-start* jobs at station start. /// [DataField("roundStartTotalJobs")] public int RoundStartTotalJobs; /// /// Total *mid-round* jobs at station start. /// [DataField("midRoundTotalJobs")] public int MidRoundTotalJobs; /// /// Current total jobs. /// [DataField("totalJobs")] public int TotalJobs; /// /// Station is running on extended access. /// [DataField("extendedAccess")] public bool ExtendedAccess; /// /// 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. /// /// /// Set to -1 to disable extended access. /// [DataField("extendedAccessThreshold")] public int ExtendedAccessThreshold { get; set; } = 15; /// /// The percentage of jobs remaining. /// /// /// Null if MidRoundTotalJobs is zero. This is a NaN free API. /// [ViewVariables] public float? PercentJobsRemaining => MidRoundTotalJobs > 0 ? TotalJobs / (float) MidRoundTotalJobs : null; /// /// The current list of jobs. /// /// /// This should not be mutated or used directly unless you really know what you're doing, go through StationJobsSystem. /// [DataField("jobList", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] public Dictionary JobList = new(); /// /// The round-start list of jobs. /// /// /// This should not be mutated, ever. /// [DataField("roundStartJobList", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] public Dictionary RoundStartJobList = new(); /// /// Overflow jobs that round-start can spawn infinitely many of. /// [DataField("overflowJobs", customTypeSerializer: typeof(PrototypeIdHashSetSerializer))] public HashSet OverflowJobs = new(); [DataField("availableJobs", required: true, customTypeSerializer: typeof(PrototypeIdDictionarySerializer, JobPrototype>))] public readonly Dictionary> SetupAvailableJobs = default!; }