Show / Hide Table of Contents

Class StationJobsSystem

Manages job slots for stations.

Inheritance
System.Object
StationJobsSystem
Namespace: Content.Server.Station.Systems
Assembly: Content.Server.dll
Syntax
public sealed class StationJobsSystem : EntitySystem

Methods

| Improve this Doc View Source

AssignJobs(Dictionary<NetUserId, HumanoidCharacterProfile>, IReadOnlyList<EntityUid>, Boolean)

Assigns jobs based on the given preferences and list of stations to assign for. This does NOT change the slots on the station, only figures out where each player should go.

Declaration
public Dictionary<NetUserId, (string? , EntityUid)> AssignJobs(Dictionary<NetUserId, HumanoidCharacterProfile> profiles, IReadOnlyList<EntityUid> stations, bool useRoundStartJobs = true)
Parameters
Type Name Description
Dictionary<Robust.Shared.Network.NetUserId, HumanoidCharacterProfile> profiles

The profiles to use for selection.

IReadOnlyList<EntityUid> stations

List of stations to assign for.

System.Boolean useRoundStartJobs

Whether or not to use the round-start jobs for the stations instead of their current jobs.

Returns
Type Description
Dictionary<Robust.Shared.Network.NetUserId, System.ValueTuple<System.Nullable<System.String>, EntityUid>>

List of players and their assigned jobs.

Remarks

You probably shouldn't use useRoundStartJobs mid-round if the station has been available to join, as there may end up being more round-start slots than available slots, which can cause weird behavior. A warning to all who enter ye cursed lands: This function is long and mildly incomprehensible. Best used without touching.

| Improve this Doc View Source

AssignOverflowJobs(ref Dictionary<NetUserId, (Nullable<String>, EntityUid)>, IEnumerable<NetUserId>, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile>, IReadOnlyList<EntityUid>)

Attempts to assign overflow jobs to any player in allPlayersToAssign that is not in assignedJobs.

Declaration
public void AssignOverflowJobs(ref Dictionary<NetUserId, (string? , EntityUid)> assignedJobs, IEnumerable<NetUserId> allPlayersToAssign, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> profiles, IReadOnlyList<EntityUid> stations)
Parameters
Type Name Description
Dictionary<Robust.Shared.Network.NetUserId, System.ValueTuple<System.Nullable<System.String>, EntityUid>> assignedJobs

All assigned jobs.

IEnumerable<Robust.Shared.Network.NetUserId> allPlayersToAssign

All players that might need an overflow assigned.

IReadOnlyDictionary<Robust.Shared.Network.NetUserId, HumanoidCharacterProfile> profiles

Player character profiles.

IReadOnlyList<EntityUid> stations

The stations to consider for spawn location.

| Improve this Doc View Source

CalcExtendedAccess(Dictionary<EntityUid, Int32>)

Declaration
public void CalcExtendedAccess(Dictionary<EntityUid, int> jobsCount)
Parameters
Type Name Description
Dictionary<EntityUid, System.Int32> jobsCount
| Improve this Doc View Source

GetAvailableJobs(EntityUid, StationJobsComponent)

Returns all jobs available on the station.

Declaration
public IReadOnlySet<string> GetAvailableJobs(EntityUid station, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to get jobs for

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
IReadOnlySet<System.String>

Set containing all jobs available.

| Improve this Doc View Source

GetJobs(EntityUid, StationJobsComponent)

Returns a readonly dictionary of all jobs and their slot info.

Declaration
public IReadOnlyDictionary<string, uint?> GetJobs(EntityUid station, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to get jobs for

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
IReadOnlyDictionary<System.String, System.Nullable<System.UInt32>>

List of all jobs on the station.

| Improve this Doc View Source

GetOverflowJobs(EntityUid, StationJobsComponent)

Returns all overflow jobs available on the station.

Declaration
public IReadOnlySet<string> GetOverflowJobs(EntityUid station, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to get jobs for

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
IReadOnlySet<System.String>

Set containing all overflow jobs available.

| Improve this Doc View Source

GetRoundStartJobs(EntityUid, StationJobsComponent)

Returns a readonly dictionary of all round-start jobs and their slot info.

Declaration
public IReadOnlyDictionary<string, uint?> GetRoundStartJobs(EntityUid station, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to get jobs for

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
IReadOnlyDictionary<System.String, System.Nullable<System.UInt32>>

List of all round-start jobs.

| Improve this Doc View Source

Initialize()

Declaration
public override void Initialize()
| Improve this Doc View Source

IsJobUnlimited(EntityUid, JobPrototype, StationJobsComponent)

Declaration
public bool IsJobUnlimited(EntityUid station, JobPrototype job, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to check.

JobPrototype job

Job to check.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsJobUnlimited(EntityUid, String, StationJobsComponent)

Checks if the given job is unlimited.

Declaration
public bool IsJobUnlimited(EntityUid station, string jobPrototypeId, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to check.

System.String jobPrototypeId

Job prototype ID to check.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean

Returns if the given slot is unlimited.

| Improve this Doc View Source

MakeJobUnlimited(EntityUid, JobPrototype, StationJobsComponent)

Declaration
public void MakeJobUnlimited(EntityUid station, JobPrototype job, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to make a job unlimited on.

JobPrototype job

Job to make unlimited.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

| Improve this Doc View Source

MakeJobUnlimited(EntityUid, String, StationJobsComponent)

Makes the given job have unlimited slots.

Declaration
public void MakeJobUnlimited(EntityUid station, string jobPrototypeId, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to make a job unlimited on.

System.String jobPrototypeId

Job prototype ID to make unlimited.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

| Improve this Doc View Source

PickBestAvailableJobWithPriority(EntityUid, IReadOnlyDictionary<String, JobPriority>, Boolean, Nullable<IReadOnlySet<String>>)

Looks at the given priority list, and picks the best available job (optionally with the given exclusions)

Declaration
public string? PickBestAvailableJobWithPriority(EntityUid station, IReadOnlyDictionary<string, JobPriority> jobPriorities, bool pickOverflows, IReadOnlySet<string>? disallowedJobs = null)
Parameters
Type Name Description
EntityUid station

Station to pick from.

IReadOnlyDictionary<System.String, JobPriority> jobPriorities

The priority list to use for selecting a job.

System.Boolean pickOverflows

Whether or not to pick from the overflow list.

System.Nullable<IReadOnlySet<System.String>> disallowedJobs

A set of disallowed jobs, if any.

Returns
Type Description
System.Nullable<System.String>

The selected job, if any.

| Improve this Doc View Source

TryAdjustJobSlot(EntityUid, JobPrototype, Int32, Boolean, Boolean, StationJobsComponent)

Declaration
public bool TryAdjustJobSlot(EntityUid station, JobPrototype job, int amount, bool createSlot = false, bool clamp = false, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to adjust the job slot on.

JobPrototype job

Job to adjust.

System.Int32 amount

Amount to adjust by.

System.Boolean createSlot

Whether or not it should create the slot if it doesn't exist.

System.Boolean clamp

Whether or not to clamp to zero if you'd remove more jobs than are available.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryAdjustJobSlot(EntityUid, String, Int32, Boolean, Boolean, StationJobsComponent)

Attempts to adjust the given job slot by the amount provided.

Declaration
public bool TryAdjustJobSlot(EntityUid station, string jobPrototypeId, int amount, bool createSlot = false, bool clamp = false, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to adjust the job slot on.

System.String jobPrototypeId

Job prototype ID to adjust.

System.Int32 amount

Amount to adjust by.

System.Boolean createSlot

Whether or not it should create the slot if it doesn't exist.

System.Boolean clamp

Whether or not to clamp to zero if you'd remove more jobs than are available.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean

Whether or not slot adjustment was a success.

| Improve this Doc View Source

TryAssignJob(EntityUid, JobPrototype, StationJobsComponent)

Declaration
public bool TryAssignJob(EntityUid station, JobPrototype job, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to assign a job on.

JobPrototype job

Job to assign.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryAssignJob(EntityUid, String, StationJobsComponent)

Attempts to assign the given job once. (essentially, it decrements the slot if possible).

Declaration
public bool TryAssignJob(EntityUid station, string jobPrototypeId, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to assign a job on.

System.String jobPrototypeId

Job prototype ID to assign.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean

Whether or not assignment was a success.

| Improve this Doc View Source

TryGetJobSlot(EntityUid, JobPrototype, out Nullable<UInt32>, StationJobsComponent)

Declaration
public bool TryGetJobSlot(EntityUid station, JobPrototype job, out uint? slots, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to get slot info from.

JobPrototype job

Job to get slot info for.

System.Nullable<System.UInt32> slots

The number of slots remaining. Null if infinite.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryGetJobSlot(EntityUid, String, out Nullable<UInt32>, StationJobsComponent)

Returns information about the given job slot.

Declaration
public bool TryGetJobSlot(EntityUid station, string jobPrototypeId, out uint? slots, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to get slot info from.

System.String jobPrototypeId

Job prototype ID to get slot info for.

System.Nullable<System.UInt32> slots

The number of slots remaining. Null if infinite.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean

Whether or not the slot exists.

Remarks

slots will be null if the slot doesn't exist, as well, so make sure to check the return value.

| Improve this Doc View Source

TrySetJobSlot(EntityUid, JobPrototype, Int32, Boolean, StationJobsComponent)

Declaration
public bool TrySetJobSlot(EntityUid station, JobPrototype jobPrototype, int amount, bool createSlot = false, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to adjust the job slot on.

JobPrototype jobPrototype

Job prototype to adjust.

System.Int32 amount

Amount to set to.

System.Boolean createSlot

Whether or not it should create the slot if it doesn't exist.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

TrySetJobSlot(EntityUid, String, Int32, Boolean, StationJobsComponent)

Attempts to set the given job slot to the amount provided.

Declaration
public bool TrySetJobSlot(EntityUid station, string jobPrototypeId, int amount, bool createSlot = false, StationJobsComponent stationJobs = null)
Parameters
Type Name Description
EntityUid station

Station to adjust the job slot on.

System.String jobPrototypeId

Job prototype ID to adjust.

System.Int32 amount

Amount to set to.

System.Boolean createSlot

Whether or not it should create the slot if it doesn't exist.

StationJobsComponent stationJobs

Resolve pattern, station jobs component of the station.

Returns
Type Description
System.Boolean

Whether or not setting the value succeeded.

| Improve this Doc View Source

Update(Single)

Declaration
public override void Update(float _)
Parameters
Type Name Description
System.Single _
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾