2021-12-01 00:40:46 +11:00
|
|
|
using Content.Shared.Access;
|
2024-06-07 00:05:58 +12:00
|
|
|
using Content.Shared.Guidebook;
|
2022-08-07 08:00:42 +02:00
|
|
|
using Content.Shared.Players.PlayTimeTracking;
|
2023-07-29 10:25:27 +02:00
|
|
|
using Content.Shared.StatusIcon;
|
2019-11-17 11:18:39 -05:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-12-30 00:48:18 +11:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
2019-11-17 11:18:39 -05:00
|
|
|
|
2020-08-13 14:40:27 +02:00
|
|
|
namespace Content.Shared.Roles
|
2019-11-17 11:18:39 -05:00
|
|
|
{
|
2020-01-19 18:31:14 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Describes information for a single job on the station.
|
|
|
|
|
/// </summary>
|
2025-03-19 14:30:31 -04:00
|
|
|
[Prototype]
|
2023-11-01 19:56:23 -07:00
|
|
|
public sealed partial class JobPrototype : IPrototype
|
2019-11-17 11:18:39 -05:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[ViewVariables]
|
2023-01-19 03:56:45 +01:00
|
|
|
[IdDataField]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string ID { get; private set; } = default!;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
2022-11-16 20:22:11 +01:00
|
|
|
[DataField("playTimeTracker", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<PlayTimeTrackerPrototype>))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string PlayTimeTracker { get; private set; } = string.Empty;
|
2022-08-07 08:00:42 +02:00
|
|
|
|
2024-09-12 12:36:41 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Who is the supervisor for this job.
|
|
|
|
|
/// </summary>
|
2021-10-06 13:51:11 +02:00
|
|
|
[DataField("supervisors")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string Supervisors { get; private set; } = "nobody";
|
2021-10-06 13:51:11 +02:00
|
|
|
|
2020-01-19 18:31:14 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// The name of this job as displayed to players.
|
|
|
|
|
/// </summary>
|
2021-05-04 15:37:16 +02:00
|
|
|
[DataField("name")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string Name { get; private set; } = string.Empty;
|
2019-11-17 11:18:39 -05:00
|
|
|
|
2022-06-28 15:55:05 +03:00
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
|
|
|
|
public string LocalizedName => Loc.GetString(Name);
|
|
|
|
|
|
2022-10-26 13:52:21 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// The name of this job as displayed to players.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("description")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string? Description { get; private set; }
|
2022-10-26 13:52:21 +02:00
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
|
|
|
|
public string? LocalizedDescription => Description is null ? null : Loc.GetString(Description);
|
|
|
|
|
|
2024-09-12 12:36:41 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Requirements for the job.
|
|
|
|
|
/// </summary>
|
2024-06-08 04:43:02 +12:00
|
|
|
[DataField, Access(typeof(SharedRoleSystem), Other = AccessPermissions.None)]
|
2022-08-07 08:00:42 +02:00
|
|
|
public HashSet<JobRequirement>? Requirements;
|
|
|
|
|
|
2024-09-12 12:36:41 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// When true - the station will have anouncement about arrival of this player.
|
|
|
|
|
/// </summary>
|
2021-10-06 13:51:11 +02:00
|
|
|
[DataField("joinNotifyCrew")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public bool JoinNotifyCrew { get; private set; } = false;
|
2021-10-06 13:51:11 +02:00
|
|
|
|
2024-09-12 12:36:41 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// When true - the player will recieve a message about importancy of their job.
|
|
|
|
|
/// </summary>
|
2021-10-06 13:51:11 +02:00
|
|
|
[DataField("requireAdminNotify")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public bool RequireAdminNotify { get; private set; } = false;
|
2021-10-06 13:51:11 +02:00
|
|
|
|
2024-09-12 12:36:41 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Should this job appear in preferences menu?
|
|
|
|
|
/// </summary>
|
2021-12-19 07:36:16 -08:00
|
|
|
[DataField("setPreference")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public bool SetPreference { get; private set; } = true;
|
2024-09-12 12:36:41 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Should the selected traits be applied for this job?
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public bool ApplyTraits { get; private set; } = true;
|
2021-12-19 07:36:16 -08:00
|
|
|
|
2024-02-01 11:13:44 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this job should show in the ID Card Console.
|
|
|
|
|
/// If set to null, it will default to SetPreference's value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public bool? OverrideConsoleVisibility { get; private set; } = null;
|
|
|
|
|
|
2021-11-21 20:33:50 -06:00
|
|
|
[DataField("canBeAntag")]
|
2023-08-22 18:14:33 -07:00
|
|
|
public bool CanBeAntag { get; private set; } = true;
|
2021-11-21 20:33:50 -06:00
|
|
|
|
2020-01-19 18:31:14 +01:00
|
|
|
/// <summary>
|
2024-06-06 02:19:24 +12:00
|
|
|
/// The "weight" or importance of this job. If this number is large, the job system will assign this job
|
|
|
|
|
/// before assigning other jobs.
|
2020-01-19 18:31:14 +01:00
|
|
|
/// </summary>
|
2022-05-10 13:43:30 -05:00
|
|
|
[DataField("weight")]
|
|
|
|
|
public int Weight { get; private set; }
|
2020-01-19 18:31:14 +01:00
|
|
|
|
Make department / job list sorting consistent. (#25486)
* Make department / job list sorting consistent.
This makes late join, crew manifest and character profile all apply consistent sorting for jobs and departments.
We use the already-defined weights for departments (so command, then sec, then station specific, then just sort by prototype ID). Jobs also use weight (so heads are always at the top) then prototype ID, then character name (for manifest).
Removed the crewmanifest.ordering CVar as doing it via prototype weight is just easier, and that CVar was already a mess anyways.
* Fix jittery job icons in lists.
They were set to KeepCentered in TextureRect. This has issues because the allocated space is actually an odd number of pixels, so it tries to position the draw at a half pixel offset.
Now, yes, fixing this in TextureRect would make much more sense, but get off my back. (Ok seriously we need better helper functions for doing that in the engine. Don't wanna deal with that right now and I already have this patch made.)
Instead I'm just gonna fix the issue by using VerticalAlignment in all these places instead which ends up doing exactly the same thing YIPPEE.
Also gave a margin next to the icon on the crew manifest. Margins people!
2024-02-23 05:04:44 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// How to sort this job relative to other jobs in the UI.
|
|
|
|
|
/// Jobs with a higher value with sort before jobs with a lower value.
|
|
|
|
|
/// If not set, <see cref="Weight"/> is used as a fallback.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public int? DisplayWeight { get; private set; }
|
|
|
|
|
|
|
|
|
|
public int RealDisplayWeight => DisplayWeight ?? Weight;
|
|
|
|
|
|
2022-09-15 15:37:54 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// A numerical score for how much easier this job is for antagonists.
|
|
|
|
|
/// For traitors, reduces starting TC by this amount. Other gamemodes can use it for whatever they find fitting.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("antagAdvantage")]
|
|
|
|
|
public int AntagAdvantage = 0;
|
|
|
|
|
|
2024-08-05 14:42:25 +10:00
|
|
|
[DataField]
|
|
|
|
|
public ProtoId<StartingGearPrototype>? StartingGear { get; private set; }
|
2020-01-24 16:31:18 +01:00
|
|
|
|
2022-07-10 21:10:03 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Use this to spawn in as a non-humanoid (borg, test subject, etc.)
|
|
|
|
|
/// Starting gear will be ignored.
|
|
|
|
|
/// If you want to just add special attributes to a humanoid, use AddComponentSpecial instead.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("jobEntity", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
|
|
|
|
public string? JobEntity = null;
|
|
|
|
|
|
2024-12-08 02:46:41 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Entity to use as a preview in the lobby/character editor.
|
|
|
|
|
/// Same restrictions as <see cref="JobEntity"/> apply.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public EntProtoId? JobPreviewEntity = null;
|
|
|
|
|
|
2024-06-03 12:12:21 -04:00
|
|
|
[DataField]
|
2024-08-09 08:14:07 +02:00
|
|
|
public ProtoId<JobIconPrototype> Icon { get; private set; } = "JobIconUnknown";
|
2020-07-26 14:08:09 +02:00
|
|
|
|
2023-07-29 10:25:27 +02:00
|
|
|
[DataField("special", serverOnly: true)]
|
2021-09-16 15:17:19 +02:00
|
|
|
public JobSpecial[] Special { get; private set; } = Array.Empty<JobSpecial>();
|
2019-11-17 11:18:39 -05:00
|
|
|
|
2024-04-01 09:06:13 +03:00
|
|
|
[DataField("access")]
|
|
|
|
|
public IReadOnlyCollection<ProtoId<AccessLevelPrototype>> Access { get; private set; } = Array.Empty<ProtoId<AccessLevelPrototype>>();
|
2022-02-11 19:01:14 -07:00
|
|
|
|
2024-04-01 09:06:13 +03:00
|
|
|
[DataField("accessGroups")]
|
|
|
|
|
public IReadOnlyCollection<ProtoId<AccessGroupPrototype>> AccessGroups { get; private set; } = Array.Empty<ProtoId<AccessGroupPrototype>>();
|
2022-05-27 06:01:07 +02:00
|
|
|
|
2024-04-01 09:06:13 +03:00
|
|
|
[DataField("extendedAccess")]
|
|
|
|
|
public IReadOnlyCollection<ProtoId<AccessLevelPrototype>> ExtendedAccess { get; private set; } = Array.Empty<ProtoId<AccessLevelPrototype>>();
|
2022-05-27 06:01:07 +02:00
|
|
|
|
2024-04-01 09:06:13 +03:00
|
|
|
[DataField("extendedAccessGroups")]
|
|
|
|
|
public IReadOnlyCollection<ProtoId<AccessGroupPrototype>> ExtendedAccessGroups { get; private set; } = Array.Empty<ProtoId<AccessGroupPrototype>>();
|
2024-06-01 05:08:31 -07:00
|
|
|
|
|
|
|
|
[DataField]
|
|
|
|
|
public bool Whitelisted;
|
2024-06-07 00:05:58 +12:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Optional list of guides associated with this role. If the guides are opened, the first entry in this list
|
|
|
|
|
/// will be used to select the currently selected guidebook.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public List<ProtoId<GuideEntryPrototype>>? Guides;
|
2019-11-17 11:18:39 -05:00
|
|
|
}
|
Make department / job list sorting consistent. (#25486)
* Make department / job list sorting consistent.
This makes late join, crew manifest and character profile all apply consistent sorting for jobs and departments.
We use the already-defined weights for departments (so command, then sec, then station specific, then just sort by prototype ID). Jobs also use weight (so heads are always at the top) then prototype ID, then character name (for manifest).
Removed the crewmanifest.ordering CVar as doing it via prototype weight is just easier, and that CVar was already a mess anyways.
* Fix jittery job icons in lists.
They were set to KeepCentered in TextureRect. This has issues because the allocated space is actually an odd number of pixels, so it tries to position the draw at a half pixel offset.
Now, yes, fixing this in TextureRect would make much more sense, but get off my back. (Ok seriously we need better helper functions for doing that in the engine. Don't wanna deal with that right now and I already have this patch made.)
Instead I'm just gonna fix the issue by using VerticalAlignment in all these places instead which ends up doing exactly the same thing YIPPEE.
Also gave a margin next to the icon on the crew manifest. Margins people!
2024-02-23 05:04:44 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sorts <see cref="JobPrototype"/>s appropriately for display in the UI,
|
|
|
|
|
/// respecting their <see cref="JobPrototype.Weight"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class JobUIComparer : IComparer<JobPrototype>
|
|
|
|
|
{
|
|
|
|
|
public static readonly JobUIComparer Instance = new();
|
|
|
|
|
|
|
|
|
|
public int Compare(JobPrototype? x, JobPrototype? y)
|
|
|
|
|
{
|
|
|
|
|
if (ReferenceEquals(x, y))
|
|
|
|
|
return 0;
|
|
|
|
|
if (ReferenceEquals(null, y))
|
|
|
|
|
return 1;
|
|
|
|
|
if (ReferenceEquals(null, x))
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
var cmp = -x.RealDisplayWeight.CompareTo(y.RealDisplayWeight);
|
|
|
|
|
if (cmp != 0)
|
|
|
|
|
return cmp;
|
|
|
|
|
return string.Compare(x.ID, y.ID, StringComparison.Ordinal);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-17 11:18:39 -05:00
|
|
|
}
|