CatStation/Content.Shared/Station/Components/StationJobsComponent.cs
Princess Cheeseballs 2c6ffecf62
Move GameTicker to Shared (#45834)
* Scope creep my ass

* why was this shit not pushed????

* gone...

* fix that

* review plus buildd

* asfsafsafsafsafas

* grug

* burber

* I'll fix this later

* shrimply die

* also this

* it's snerf or snuthin

* assaads

* round snend

* aaaa

* fix this shit for real

* actually, don't start GameRules until MapInit now that I think aboot it.

* forgot u

* don't actually need this part nullable

* Deffer comp removal

* one liner

* do that too

* chungus

* Honestly makes more sense here, plus WHY are we doing all that shit on "GameRuleAdded" rather than GameRuleStarted(?)

* deferred removal :V

* aaaaaaaaaaaaaaa

* whhop

* Whoop

* better

* landmine that I placed for myself then forgot about lmao

* cleanup

* FUCKING `!`

* gotovo

* amogus

* please don't check by metadata I beg

* waawsasfdfsasfa

* sfafsasfafsas

* fdsaasffsasfa

* code

* fix

* fasasffasfasfsad

* chungaas

* I may be stupid

* gra

* graaaaaaaaaaaaaaaaa

* comment

* gra

* clearing is not predicted and would require major refactors, so don't cache on client.

* lame shit :P

* last holes

* nukeopsfsafsasafsfafsa

* why  was that shit public bruh

* bubrbgwahrghfaka

* dynamic

* revert change that did nothing lmao
2026-09-16 19:34:19 +00:00

79 lines
2.7 KiB
C#

using Content.Shared.Roles;
using Content.Shared.Station.Systems;
using JetBrains.Annotations;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
namespace Content.Shared.Station.Components;
/// <summary>
/// Stores information about a station's job selection.
/// </summary>
[RegisterComponent, Access(typeof(StationJobsSystem)), PublicAPI]
public sealed partial class StationJobsComponent : Component
{
/// <summary>
/// Total *mid-round* jobs at station start.
/// This is inferred automatically from <see cref="SetupAvailableJobs"/>.
/// </summary>
[ViewVariables] public int MidRoundTotalJobs;
/// <summary>
/// Current total jobs.
/// </summary>
[DataField] public int TotalJobs;
/// <summary>
/// Station is running on extended access.
/// </summary>
[DataField] 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]
public int ExtendedAccessThreshold { get; set; } = 15;
/// <summary>
/// The percentage of jobs remaining.
/// </summary>
/// <remarks>
/// Null if MidRoundTotalJobs is zero. This is a NaN free API.
/// </remarks>
[ViewVariables]
public float? PercentJobsRemaining => MidRoundTotalJobs > 0 ? TotalJobs / (float) MidRoundTotalJobs : null;
/// <summary>
/// The current list of jobs of available jobs. Null implies that is no limit.
/// </summary>
/// <remarks>
/// This should not be mutated or used directly unless you really know what you're doing, go through StationJobsSystem.
/// </remarks>
[DataField]
public Dictionary<ProtoId<JobPrototype>, int?> JobList = new();
/// <summary>
/// Overflow jobs that round-start can spawn infinitely many of.
/// This is inferred automatically from <see cref="SetupAvailableJobs"/>.
/// </summary>
[ViewVariables]
public IReadOnlySet<ProtoId<JobPrototype>> OverflowJobs = default!;
/// <summary>
/// A dictionary relating a NetUserId to the jobs they have on station.
/// An OOC way to track where job slots have gone.
/// </summary>
[DataField]
public Dictionary<NetUserId, List<ProtoId<JobPrototype>>> PlayerJobs = new();
/// <summary>
/// Mapping of jobs to an int[2] array that specifies jobs available at round start, and midround.
/// Negative values implies that there is no limit.
/// </summary>
[DataField("availableJobs", required: true)]
public Dictionary<ProtoId<JobPrototype>, int[]> SetupAvailableJobs = default!;
}