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; /// /// 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(); }