Add ERT time stats (#31629)

* add jobs for ghost roles

* add job to ToggleableGhostRole

* typo

---------

Co-authored-by: Mota <belochuc@gmail.com>
This commit is contained in:
poeMota
2024-09-02 08:32:49 +03:00
committed by GitHub
parent 738e0cf0df
commit 9a51d37d02
6 changed files with 41 additions and 3 deletions

View 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;
}

View 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;
}

View 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));
}

View 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)

View File

@@ -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 ]

View 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