]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add ERT time stats (#31629)
authorpoeMota <142114334+poeMota@users.noreply.github.com>
Mon, 2 Sep 2024 05:32:49 +0000 (08:32 +0300)
committerGitHub <noreply@github.com>
Mon, 2 Sep 2024 05:32:49 +0000 (10:32 +0500)
* add jobs for ghost roles

* add job to ToggleableGhostRole

* typo

---------

Co-authored-by: Mota <belochuc@gmail.com>
Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
Content.Server/Ghost/Roles/Components/ToggleableGhostRoleComponent.cs
Content.Server/Ghost/Roles/GhostRoleSystem.cs
Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs
Resources/Prototypes/Entities/Mobs/Player/humanoid.yml
Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml

index 8089941444ff500e725c5774f23038e3931918ab..3dea97cb5d020a368a66e5f41c604892b6253854 100644 (file)
@@ -1,6 +1,7 @@
-using Content.Server.Ghost.Roles.Raffles;
+using Content.Server.Ghost.Roles.Raffles;
 using Content.Server.Mind.Commands;
 using Content.Shared.Roles;
+using Robust.Shared.Prototypes;
 
 namespace Content.Server.Ghost.Roles.Components;
 
@@ -14,7 +15,6 @@ public sealed partial class GhostRoleComponent : Component
 
     [DataField("rules")] private string _roleRules = "ghost-role-component-default-rules";
 
-    // TODO ROLE TIMERS
     // Actually make use of / enforce this requirement?
     // Why is this even here.
     // Move to ghost role prototype & respect CCvars.GameRoleTimerOverride
@@ -99,4 +99,11 @@ public sealed partial class GhostRoleComponent : Component
     [DataField("raffle")]
     [Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
     public GhostRoleRaffleConfig? RaffleConfig { get; set; }
+
+    /// <summary>
+    /// Job the entity will receive after adding the mind.
+    /// </summary>
+    [DataField("job")]
+    [Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // also FIXME Friends
+    public ProtoId<JobPrototype>? JobProto = null;
 }
index ef1b1dbed99ee6d878ce025899d7ff55875d5e83..fa95014f21b1f56c5cfe629511ab7df17d0838ac 100644 (file)
@@ -1,4 +1,7 @@
-namespace Content.Server.Ghost.Roles.Components;
+using Content.Shared.Roles;
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.Ghost.Roles.Components;
 
 /// <summary>
 /// This is used for a ghost role which can be toggled on and off at will, like a PAI.
@@ -38,4 +41,7 @@ public sealed partial class ToggleableGhostRoleComponent : Component
 
     [DataField("stopSearchVerbPopup")]
     public string StopSearchVerbPopup = string.Empty;
+
+    [DataField("job")]
+    public ProtoId<JobPrototype>? JobProto = null;
 }
index 4580e2ef36d3f65957fa9e3efdbf647862201db6..23ce0f1539877ddcdaf95532d175fc0b221ff01f 100644 (file)
@@ -33,6 +33,7 @@ using Content.Server.Popups;
 using Content.Shared.Verbs;
 using Robust.Shared.Collections;
 using Content.Shared.Ghost.Roles.Components;
+using Content.Shared.Roles.Jobs;
 
 namespace Content.Server.Ghost.Roles;
 
@@ -599,6 +600,14 @@ public sealed class GhostRoleSystem : EntitySystem
         if (!TryComp(uid, out GhostRoleComponent? ghostRole))
             return;
 
+        if (ghostRole.JobProto != null)
+        {
+            if (HasComp<JobComponent>(args.Mind))
+                _roleSystem.MindRemoveRole<JobComponent>(args.Mind);
+
+            _roleSystem.MindAddRole(args.Mind, new JobComponent { Prototype = ghostRole.JobProto });
+        }
+
         ghostRole.Taken = true;
         UnregisterGhostRole((uid, ghostRole));
     }
index 64e46bb608a0de56f1f5d52abd0da7c40f898f61..1f46bacaa07dd038d3c6f3aa2bd3dafe6ab0186c 100644 (file)
@@ -54,6 +54,7 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem
         ghostRole.RoleName = Loc.GetString(component.RoleName);
         ghostRole.RoleDescription = Loc.GetString(component.RoleDescription);
         ghostRole.RoleRules = Loc.GetString(component.RoleRules);
+        ghostRole.JobProto = component.JobProto;
     }
 
     private void OnExamined(EntityUid uid, ToggleableGhostRoleComponent component, ExaminedEvent args)
index 40e0444bc90ce71c6655f2db9a2b7bb34b3425d1..7be5ac3f230abbcc7565b5e813b64a2811df4561 100644 (file)
@@ -79,6 +79,7 @@
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTLeader
     - type: Loadout
       prototypes: [ ERTLeaderGear ]
       roleLoadout: [ RoleSurvivalExtended ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTLeader
     - type: Loadout
       prototypes: [ ERTLeaderGearEVA ]
       roleLoadout: [ RoleSurvivalEVA ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTLeader
     - type: Loadout
       prototypes: [ ERTLeaderGearEVALecter ]
       roleLoadout: [ RoleSurvivalEVA ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTChaplain
     - type: RandomMetadata
       nameSegments:
       - NamesFirstMilitary
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTChaplain
     - type: Loadout
       prototypes: [ ERTChaplainGearEVA ]
       roleLoadout: [ RoleSurvivalEVA ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTJanitor
     - type: RandomMetadata
       nameSegments:
       - NamesFirstMilitary
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTJanitor
     - type: Loadout
       prototypes: [ ERTJanitorGearEVA ]
       roleLoadout: [ RoleSurvivalEVA ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTEngineer
     - type: RandomMetadata
       nameSegments:
       - NamesFirstMilitary
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTEngineer
     - type: Loadout
       prototypes: [ ERTEngineerGearEVA ]
       roleLoadout: [ RoleSurvivalEVA ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTSecurity
     - type: RandomMetadata
       nameSegments:
       - NamesFirstMilitary
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTSecurity
     - type: Loadout
       prototypes: [ ERTSecurityGearEVA ]
       roleLoadout: [ RoleSurvivalEVA ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTSecurity
     - type: Loadout
       prototypes: [ ERTSecurityGearEVALecter ]
       roleLoadout: [ RoleSurvivalEVA ]
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTMedical
     - type: RandomMetadata
       nameSegments:
       - NamesFirstMilitary
       rules: ghost-role-information-nonantagonist-rules
       raffle:
         settings: short
+      job: ERTMedical
     - type: Loadout
       prototypes: [ ERTMedicalGearEVA ]
       roleLoadout: [ RoleSurvivalEVA ]
index 2d2620efca8ff272f9c4afedcfdcae9277c97378..5155e70cca44420a9e37261bfbf9c2015ce9060e 100644 (file)
@@ -89,6 +89,7 @@
       wipeVerbPopup: positronic-brain-wiped-device
       stopSearchVerbText: positronic-brain-stop-searching-verb-text
       stopSearchVerbPopup: positronic-brain-stopped-searching
+      job: Borg
     - type: BlockMovement
     - type: Examiner
     - type: BorgBrain