From 9a51d37d0205f6de68bbe9705816076c3ded22d7 Mon Sep 17 00:00:00 2001 From: poeMota <142114334+poeMota@users.noreply.github.com> Date: Mon, 2 Sep 2024 08:32:49 +0300 Subject: [PATCH] Add ERT time stats (#31629) * add jobs for ghost roles * add job to ToggleableGhostRole * typo --------- Co-authored-by: Mota --- .../Ghost/Roles/Components/GhostRoleComponent.cs | 11 +++++++++-- .../Components/ToggleableGhostRoleComponent.cs | 8 +++++++- Content.Server/Ghost/Roles/GhostRoleSystem.cs | 9 +++++++++ .../Ghost/Roles/ToggleableGhostRoleSystem.cs | 1 + .../Prototypes/Entities/Mobs/Player/humanoid.yml | 14 ++++++++++++++ .../Entities/Objects/Specific/Robotics/mmi.yml | 1 + 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs index 8089941444..3dea97cb5d 100644 --- a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs @@ -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; } + + /// + /// Job the entity will receive after adding the mind. + /// + [DataField("job")] + [Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // also FIXME Friends + public ProtoId? JobProto = null; } diff --git a/Content.Server/Ghost/Roles/Components/ToggleableGhostRoleComponent.cs b/Content.Server/Ghost/Roles/Components/ToggleableGhostRoleComponent.cs index ef1b1dbed9..fa95014f21 100644 --- a/Content.Server/Ghost/Roles/Components/ToggleableGhostRoleComponent.cs +++ b/Content.Server/Ghost/Roles/Components/ToggleableGhostRoleComponent.cs @@ -1,4 +1,7 @@ -namespace Content.Server.Ghost.Roles.Components; +using Content.Shared.Roles; +using Robust.Shared.Prototypes; + +namespace Content.Server.Ghost.Roles.Components; /// /// 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? JobProto = null; } diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index 4580e2ef36..23ce0f1539 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -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(args.Mind)) + _roleSystem.MindRemoveRole(args.Mind); + + _roleSystem.MindAddRole(args.Mind, new JobComponent { Prototype = ghostRole.JobProto }); + } + ghostRole.Taken = true; UnregisterGhostRole((uid, ghostRole)); } diff --git a/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs b/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs index 64e46bb608..1f46bacaa0 100644 --- a/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs @@ -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) diff --git a/Resources/Prototypes/Entities/Mobs/Player/humanoid.yml b/Resources/Prototypes/Entities/Mobs/Player/humanoid.yml index 40e0444bc9..7be5ac3f23 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/humanoid.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/humanoid.yml @@ -79,6 +79,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTLeader - type: Loadout prototypes: [ ERTLeaderGear ] roleLoadout: [ RoleSurvivalExtended ] @@ -109,6 +110,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTLeader - type: Loadout prototypes: [ ERTLeaderGearEVA ] roleLoadout: [ RoleSurvivalEVA ] @@ -131,6 +133,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTLeader - type: Loadout prototypes: [ ERTLeaderGearEVALecter ] roleLoadout: [ RoleSurvivalEVA ] @@ -163,6 +166,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTChaplain - type: RandomMetadata nameSegments: - NamesFirstMilitary @@ -194,6 +198,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTChaplain - type: Loadout prototypes: [ ERTChaplainGearEVA ] roleLoadout: [ RoleSurvivalEVA ] @@ -227,6 +232,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTJanitor - type: RandomMetadata nameSegments: - NamesFirstMilitary @@ -257,6 +263,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTJanitor - type: Loadout prototypes: [ ERTJanitorGearEVA ] roleLoadout: [ RoleSurvivalEVA ] @@ -289,6 +296,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTEngineer - type: RandomMetadata nameSegments: - NamesFirstMilitary @@ -319,6 +327,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTEngineer - type: Loadout prototypes: [ ERTEngineerGearEVA ] roleLoadout: [ RoleSurvivalEVA ] @@ -351,6 +360,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTSecurity - type: RandomMetadata nameSegments: - NamesFirstMilitary @@ -381,6 +391,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTSecurity - type: Loadout prototypes: [ ERTSecurityGearEVA ] roleLoadout: [ RoleSurvivalEVA ] @@ -403,6 +414,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTSecurity - type: Loadout prototypes: [ ERTSecurityGearEVALecter ] roleLoadout: [ RoleSurvivalEVA ] @@ -435,6 +447,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTMedical - type: RandomMetadata nameSegments: - NamesFirstMilitary @@ -465,6 +478,7 @@ rules: ghost-role-information-nonantagonist-rules raffle: settings: short + job: ERTMedical - type: Loadout prototypes: [ ERTMedicalGearEVA ] roleLoadout: [ RoleSurvivalEVA ] diff --git a/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml b/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml index 2d2620efca..5155e70cca 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml @@ -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 -- 2.51.2