diff --git a/Content.Server/Traits/TraitSystem.cs b/Content.Server/Traits/TraitSystem.cs index 3bd540a3049a4f..e19f736f0676b7 100644 --- a/Content.Server/Traits/TraitSystem.cs +++ b/Content.Server/Traits/TraitSystem.cs @@ -1,6 +1,7 @@ using Content.Server.GameTicking; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; +using Content.Shared.Roles; using Content.Shared.Traits; using Content.Shared.Whitelist; using Robust.Shared.Prototypes; @@ -24,6 +25,14 @@ public override void Initialize() // When the player is spawned in, add all trait components selected during character creation private void OnPlayerSpawnComplete(PlayerSpawnCompleteEvent args) { + // Check if player's job allows to apply traits + if (args.JobId == null || + !_prototypeManager.TryIndex(args.JobId ?? string.Empty, out var protoJob) || + !protoJob.ApplyTraits) + { + return; + } + foreach (var traitId in args.Profile.TraitPreferences) { if (!_prototypeManager.TryIndex(traitId, out var traitPrototype)) diff --git a/Content.Shared/Roles/JobPrototype.cs b/Content.Shared/Roles/JobPrototype.cs index e7156b34c3bdcf..1ca1600e770d4f 100644 --- a/Content.Shared/Roles/JobPrototype.cs +++ b/Content.Shared/Roles/JobPrototype.cs @@ -20,6 +20,9 @@ public sealed partial class JobPrototype : IPrototype [DataField("playTimeTracker", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))] public string PlayTimeTracker { get; private set; } = string.Empty; + /// + /// Who is the supervisor for this job. + /// [DataField("supervisors")] public string Supervisors { get; private set; } = "nobody"; @@ -41,18 +44,36 @@ public sealed partial class JobPrototype : IPrototype [ViewVariables(VVAccess.ReadOnly)] public string? LocalizedDescription => Description is null ? null : Loc.GetString(Description); + /// + /// Requirements for the job. + /// [DataField, Access(typeof(SharedRoleSystem), Other = AccessPermissions.None)] public HashSet? Requirements; + /// + /// When true - the station will have anouncement about arrival of this player. + /// [DataField("joinNotifyCrew")] public bool JoinNotifyCrew { get; private set; } = false; + /// + /// When true - the player will recieve a message about importancy of their job. + /// [DataField("requireAdminNotify")] public bool RequireAdminNotify { get; private set; } = false; + /// + /// Should this job appear in preferences menu? + /// [DataField("setPreference")] public bool SetPreference { get; private set; } = true; + /// + /// Should the selected traits be applied for this job? + /// + [DataField] + public bool ApplyTraits { get; private set; } = true; + /// /// Whether this job should show in the ID Card Console. /// If set to null, it will default to SetPreference's value. diff --git a/Resources/Prototypes/Roles/Jobs/Science/borg.yml b/Resources/Prototypes/Roles/Jobs/Science/borg.yml index fffeaff39c59e4..e35270d57dc9cf 100644 --- a/Resources/Prototypes/Roles/Jobs/Science/borg.yml +++ b/Resources/Prototypes/Roles/Jobs/Science/borg.yml @@ -12,6 +12,7 @@ icon: JobIconStationAi supervisors: job-supervisors-rd jobEntity: StationAiBrain + applyTraits: false - type: job id: Borg @@ -25,3 +26,4 @@ icon: JobIconBorg supervisors: job-supervisors-rd jobEntity: PlayerBorgGeneric + applyTraits: false