]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
don't apply traits for borg and ai (#31990)
authorlzk <124214523+lzk228@users.noreply.github.com>
Thu, 12 Sep 2024 10:36:41 +0000 (12:36 +0200)
committerGitHub <noreply@github.com>
Thu, 12 Sep 2024 10:36:41 +0000 (13:36 +0300)
* doesn't apply traits for borg or ai

* add some comment and summaries

* weh

weh

* well ok

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Content.Server/Traits/TraitSystem.cs
Content.Shared/Roles/JobPrototype.cs
Resources/Prototypes/Roles/Jobs/Science/borg.yml

index 3bd540a3049a4f93912e4823e49e9575f10d149e..e19f736f0676b7663f30f522c9a06e6414eb7947 100644 (file)
@@ -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 sealed class TraitSystem : EntitySystem
     // 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<JobPrototype>(args.JobId ?? string.Empty, out var protoJob) ||
+            !protoJob.ApplyTraits)
+        {
+            return;
+        }
+
         foreach (var traitId in args.Profile.TraitPreferences)
         {
             if (!_prototypeManager.TryIndex<TraitPrototype>(traitId, out var traitPrototype))
index e7156b34c3bdcff1dd54c02d75bb278fd9efd9a5..1ca1600e770d4f5104d678656c540d2b10e9470c 100644 (file)
@@ -20,6 +20,9 @@ namespace Content.Shared.Roles
         [DataField("playTimeTracker", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<PlayTimeTrackerPrototype>))]
         public string PlayTimeTracker { get; private set; } = string.Empty;
 
+        /// <summary>
+        ///     Who is the supervisor for this job.
+        /// </summary>
         [DataField("supervisors")]
         public string Supervisors { get; private set; } = "nobody";
 
@@ -41,18 +44,36 @@ namespace Content.Shared.Roles
         [ViewVariables(VVAccess.ReadOnly)]
         public string? LocalizedDescription => Description is null ? null : Loc.GetString(Description);
 
+        /// <summary>
+        ///     Requirements for the job.
+        /// </summary>
         [DataField, Access(typeof(SharedRoleSystem), Other = AccessPermissions.None)]
         public HashSet<JobRequirement>? Requirements;
 
+        /// <summary>
+        ///     When true - the station will have anouncement about arrival of this player.
+        /// </summary>
         [DataField("joinNotifyCrew")]
         public bool JoinNotifyCrew { get; private set; } = false;
 
+        /// <summary>
+        ///     When true - the player will recieve a message about importancy of their job.
+        /// </summary>
         [DataField("requireAdminNotify")]
         public bool RequireAdminNotify { get; private set; } = false;
 
+        /// <summary>
+        ///     Should this job appear in preferences menu?
+        /// </summary>
         [DataField("setPreference")]
         public bool SetPreference { get; private set; } = true;
 
+        /// <summary>
+        ///     Should the selected traits be applied for this job?
+        /// </summary>
+        [DataField]
+        public bool ApplyTraits { get; private set; } = true;
+
         /// <summary>
         ///     Whether this job should show in the ID Card Console.
         ///     If set to null, it will default to SetPreference's value.
index fffeaff39c59e4c59482c2107e35b0919252c6de..e35270d57dc9cf288e54a7ae287985300480143b 100644 (file)
@@ -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