From 201517755df663277d9f44e27f6b8404956b9e20 Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Thu, 20 Jun 2024 16:59:53 +1000
Subject: [PATCH 1/8] revert 1218
---
.../Access/Components/PresetIdCardComponent.cs | 6 ------
.../Station/Systems/StationSpawningSystem.cs | 10 +++++++++-
.../Entities/Objects/Misc/identification_cards.yml | 8 --------
3 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/Content.Server/Access/Components/PresetIdCardComponent.cs b/Content.Server/Access/Components/PresetIdCardComponent.cs
index 8fd0e10d423..94aef2e6ca0 100644
--- a/Content.Server/Access/Components/PresetIdCardComponent.cs
+++ b/Content.Server/Access/Components/PresetIdCardComponent.cs
@@ -11,10 +11,4 @@ public sealed partial class PresetIdCardComponent : Component
[DataField("name")]
public string? IdName;
-
- ///
- /// DeltaV: Allow changing the job title, even if it'd be otherwise set by the JobPrototype
- ///
- [DataField("customJob")]
- public string? CustomJobName;
}
diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs
index ce8177e1039..b917b9782c8 100644
--- a/Content.Server/Station/Systems/StationSpawningSystem.cs
+++ b/Content.Server/Station/Systems/StationSpawningSystem.cs
@@ -30,6 +30,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
+using Content.Server.Access.Components;
namespace Content.Server.Station.Systems;
@@ -258,7 +259,14 @@ public void SetPdaAndIdCardData(EntityUid entity, string characterName, JobProto
return;
_cardSystem.TryChangeFullName(cardId, characterName, card);
- _cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);
+
+ // DeltaV - Allow changing the job title within the prototype
+ string jobName = jobPrototype.LocalizedName;
+ if (TryComp(cardId, out var presetId))
+ jobName = presetId.CustomJobName ?? jobName;
+
+ _cardSystem.TryChangeJobTitle(cardId, jobName, card);
+ // End of DeltaV code
if (_prototypeManager.TryIndex(jobPrototype.Icon, out var jobIcon))
_cardSystem.TryChangeJobIcon(cardId, jobIcon, card);
diff --git a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
index 2f232c566a3..9a3d558a034 100644
--- a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
+++ b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
@@ -822,8 +822,6 @@
layers:
- state: default
- state: idseniorengineer
- - type: PresetIdCard # DeltaV - Change senior job titles
- customJob: Senior Engineer
- type: entity
parent: ResearchIDCard
@@ -834,8 +832,6 @@
layers:
- state: default
- state: idseniorresearcher
- - type: PresetIdCard # DeltaV - Change senior job titles
- customJob: Senior Researcher
- type: entity
parent: MedicalIDCard
@@ -846,8 +842,6 @@
layers:
- state: default
- state: idseniorphysician
- - type: PresetIdCard # DeltaV - Change senior job titles
- customJob: Senior Physician
- type: entity
parent: SecurityIDCard
@@ -858,8 +852,6 @@
layers:
- state: default
- state: idseniorofficer
- - type: PresetIdCard # DeltaV - Change senior job titles
- customJob: Senior Officer
- type: entity
parent: IDCardStandard
From 6948cc98ea74ba93ff0a33a65e1de7f28c177d9a Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Thu, 20 Jun 2024 19:18:36 +1000
Subject: [PATCH 2/8] oops wrong file
---
.../Access/Systems/PresetIdCardSystem.cs | 26 +------------------
.../Station/Systems/StationSpawningSystem.cs | 10 +------
2 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/Content.Server/Access/Systems/PresetIdCardSystem.cs b/Content.Server/Access/Systems/PresetIdCardSystem.cs
index 7aed03b74a8..0983e501a4d 100644
--- a/Content.Server/Access/Systems/PresetIdCardSystem.cs
+++ b/Content.Server/Access/Systems/PresetIdCardSystem.cs
@@ -2,10 +2,8 @@
using Content.Server.GameTicking;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
-using Content.Server.StationRecords.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.Roles;
-using Content.Shared.StationRecords;
using Content.Shared.StatusIcon;
using Robust.Shared.Prototypes;
@@ -17,8 +15,7 @@ public sealed class PresetIdCardSystem : EntitySystem
[Dependency] private readonly IdCardSystem _cardSystem = default!;
[Dependency] private readonly SharedAccessSystem _accessSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
- [Dependency] private readonly StationRecordsSystem _record = default!; // DeltaV - Allow changing the job title within the prototype
-
+
public override void Initialize()
{
SubscribeLocalEvent(OnMapInit);
@@ -41,7 +38,6 @@ private void PlayerJobsAssigned(RulePlayerJobsAssignedEvent ev)
SetupIdAccess(uid, card, true);
SetupIdName(uid, card);
- SetupIdJob(uid, card); // DeltaV - Allow changing the job title within the prototype
}
}
@@ -61,7 +57,6 @@ private void OnMapInit(EntityUid uid, PresetIdCardComponent id, MapInitEvent arg
SetupIdAccess(uid, id, extended);
SetupIdName(uid, id);
- SetupIdJob(uid, id); // DeltaV - Allow changing the job title within the prototype
}
private void SetupIdName(EntityUid uid, PresetIdCardComponent id)
@@ -71,25 +66,6 @@ private void SetupIdName(EntityUid uid, PresetIdCardComponent id)
_cardSystem.TryChangeFullName(uid, id.IdName);
}
- // DeltaV - Allow changing the job title within the prototype
- private void SetupIdJob(EntityUid uid, PresetIdCardComponent id)
- {
- if (id.CustomJobName == null)
- return;
- _cardSystem.TryChangeJobTitle(uid, id.CustomJobName);
-
- // The following code is taken from IdCardConsoleSystem
- if (!TryComp(uid, out var keyStorage)
- || keyStorage.Key is not { } key
- || !_record.TryGetRecord(key, out var record))
- {
- return;
- }
- record.JobTitle = id.CustomJobName;
- _record.Synchronize(key);
- }
- // End of DeltaV code
-
private void SetupIdAccess(EntityUid uid, PresetIdCardComponent id, bool extended)
{
if (id.JobName == null)
diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs
index b917b9782c8..ce8177e1039 100644
--- a/Content.Server/Station/Systems/StationSpawningSystem.cs
+++ b/Content.Server/Station/Systems/StationSpawningSystem.cs
@@ -30,7 +30,6 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
-using Content.Server.Access.Components;
namespace Content.Server.Station.Systems;
@@ -259,14 +258,7 @@ public void SetPdaAndIdCardData(EntityUid entity, string characterName, JobProto
return;
_cardSystem.TryChangeFullName(cardId, characterName, card);
-
- // DeltaV - Allow changing the job title within the prototype
- string jobName = jobPrototype.LocalizedName;
- if (TryComp(cardId, out var presetId))
- jobName = presetId.CustomJobName ?? jobName;
-
- _cardSystem.TryChangeJobTitle(cardId, jobName, card);
- // End of DeltaV code
+ _cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);
if (_prototypeManager.TryIndex(jobPrototype.Icon, out var jobIcon))
_cardSystem.TryChangeJobIcon(cardId, jobIcon, card);
From e2b192eeec3307135959004092fd7a37a2d8f96f Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Fri, 21 Jun 2024 03:56:12 +1000
Subject: [PATCH 3/8] commit changes
---
.../GameTicking/GameTicker.Spawning.cs | 96 ++++++++++++++++++-
.../Station/Systems/StationSpawningSystem.cs | 6 +-
Content.Shared/Roles/Jobs/SharedJobSystem.cs | 2 +
Resources/Locale/en-US/job/job-names.ftl | 5 +
.../Objects/Misc/identification_cards.yml | 8 ++
.../Jobs/Engineering/station_engineer.yml | 22 +++++
.../Roles/Jobs/Medical/medical_doctor.yml | 20 ++++
.../Roles/Jobs/Science/scientist.yml | 18 ++++
.../Roles/Jobs/Security/security_officer.yml | 22 +++++
9 files changed, 195 insertions(+), 4 deletions(-)
diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs
index 5f20feee754..bf0f7785054 100644
--- a/Content.Server/GameTicking/GameTicker.Spawning.cs
+++ b/Content.Server/GameTicking/GameTicker.Spawning.cs
@@ -11,8 +11,11 @@
using Content.Shared.Mind;
using Content.Shared.Players;
using Content.Shared.Preferences;
+using Content.Shared.Preferences.Loadouts;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
+using Content.Shared.Clothing;
+using Content.Shared.Access.Components;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -21,6 +24,11 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
+using Microsoft.CodeAnalysis;
+using Content.Shared.PDA;
+using FastAccessors;
+using Content.Server.Access.Components;
+using Content.Shared.Destructible;
namespace Content.Server.GameTicking
{
@@ -28,6 +36,7 @@ public sealed partial class GameTicker
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!;
+ [Dependency] private readonly IComponentFactory _componentFactory = default!;
[ValidatePrototypeId]
public const string ObserverPrototypeName = "MobObserver";
@@ -223,8 +232,36 @@ private void SpawnPlayer(ICommonSession player,
_mind.SetUserId(newMind, data.UserId);
var jobPrototype = _prototypeManager.Index(jobId);
+ // DeltaV - Senior ID cards
+ ProtoId? virtualJobId = null;
+ JobPrototype? virtualJobProto = null;
+ JobComponent? virtualJob = null;
+ do
+ {
+ var jobLoadout = LoadoutSystem.GetJobPrototype(jobPrototype.ID);
+
+ if (!_prototypeManager.TryIndex(jobLoadout, out RoleLoadoutPrototype? roleProto))
+ break;
+
+ RoleLoadout? loadout = null;
+ character.Loadouts.TryGetValue(jobLoadout, out loadout);
+
+ // Set to default if not present
+ if (loadout == null)
+ {
+ loadout = new RoleLoadout(jobLoadout);
+ loadout.SetDefault(_prototypeManager);
+ }
+
+ if (GetVirtualJobFromRoleLoadout(loadout, roleProto, character, out virtualJobId) && _prototypeManager.TryIndex(virtualJobId, out virtualJobProto))
+ {
+ virtualJob = new JobComponent {Prototype = virtualJobId};
+ }
+ }
+ while (false);
+ // End of DeltaV code
var job = new JobComponent {Prototype = jobId};
- _roles.MindAddRole(newMind, job, silent: silent);
+ _roles.MindAddRole(newMind, virtualJob ?? job, silent: silent);
var jobName = _jobs.MindTryGetJobName(newMind);
_playTimeTrackings.PlayerRolesChanged(player);
@@ -310,6 +347,63 @@ private void SpawnPlayer(ICommonSession player,
RaiseLocalEvent(mob, aev, true);
}
+ // DeltaV - Senior ID cards
+ private bool GetVirtualJobFromRoleLoadout(RoleLoadout loadout, RoleLoadoutPrototype roleProto, HumanoidCharacterProfile character, out ProtoId? virtualJob)
+ {
+ virtualJob = null;
+
+ // Use to read job loadout and find an ID card
+ foreach (var group in loadout.SelectedLoadouts.OrderBy(x => roleProto.Groups.FindIndex(e => e == x.Key)))
+ {
+ foreach (var items in group.Value)
+ {
+ if (!_prototypeManager.TryIndex(items.Prototype, out var loadoutProto))
+ {
+ Log.Warning($"Unable to find loadout prototype for {items.Prototype}");
+ continue;
+ }
+ if (!_prototypeManager.TryIndex(loadoutProto.Equipment, out var startingGear))
+ {
+ Log.Warning($"Unable to find starting gear {loadoutProto.Equipment} for loadout {loadoutProto}");
+ continue;
+ }
+ var entProtoId = startingGear.GetGear("id");
+ if (!_prototypeManager.TryIndex(entProtoId, out var idProto))
+ {
+ Log.Warning($"Unable to find prototype for {startingGear} for starting gear {loadoutProto.Equipment} for loadout {loadoutProto}");
+ continue;
+ }
+ if (idProto.TryGetComponent(out var pdaComponent, _componentFactory) && pdaComponent.IdCard != null)
+ {
+ ProtoId idProtoId = pdaComponent.IdCard;
+ if (!_prototypeManager.TryIndex(idProtoId, out idProto))
+ {
+ Log.Warning($"Unable to find an idCard in {idProto}");
+ return false;
+ }
+ }
+
+ if (!idProto.TryGetComponent(out var idComponent, _componentFactory))
+ {
+ Log.Warning($"Unable to find presetIdCard for {idProto}");
+ continue;
+ }
+
+ ProtoId jobProtoId = idComponent.JobName ?? string.Empty;
+ if (jobProtoId == string.Empty)
+ {
+ Log.Warning($"Empty jobProtoId!");
+ return false;
+ }
+ virtualJob = jobProtoId;
+ Log.Debug($"Successfully outputted {virtualJob} from {idProto}");
+ return true;
+ }
+ }
+ Log.Warning($"All other options exhausted");
+ return false;
+ }
+
public void Respawn(ICommonSession player)
{
_mind.WipeMind(player);
diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs
index ce8177e1039..6cff58338d1 100644
--- a/Content.Server/Station/Systems/StationSpawningSystem.cs
+++ b/Content.Server/Station/Systems/StationSpawningSystem.cs
@@ -258,10 +258,10 @@ public void SetPdaAndIdCardData(EntityUid entity, string characterName, JobProto
return;
_cardSystem.TryChangeFullName(cardId, characterName, card);
- _cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);
+ //_cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card); // Delta V - Senior ID card, job names and icon should already be set via prototype
- if (_prototypeManager.TryIndex(jobPrototype.Icon, out var jobIcon))
- _cardSystem.TryChangeJobIcon(cardId, jobIcon, card);
+ //if (_prototypeManager.TryIndex(jobPrototype.Icon, out var jobIcon))
+ // _cardSystem.TryChangeJobIcon(cardId, jobIcon, card);
var extendedAccess = false;
if (station != null)
diff --git a/Content.Shared/Roles/Jobs/SharedJobSystem.cs b/Content.Shared/Roles/Jobs/SharedJobSystem.cs
index ce4428d9fea..3e229a5ac57 100644
--- a/Content.Shared/Roles/Jobs/SharedJobSystem.cs
+++ b/Content.Shared/Roles/Jobs/SharedJobSystem.cs
@@ -39,6 +39,8 @@ private void SetupTrackerLookup()
// This breaks if you have N trackers to 1 JobId but future concern.
foreach (var job in _protoManager.EnumeratePrototypes())
{
+ if (_inverseTrackerLookup.ContainsKey(job.PlayTimeTracker)) continue; // DeltaV - we have N trackers to 1 JobId... (senior job names)
+
_inverseTrackerLookup.Add(job.PlayTimeTracker, job.ID);
}
}
diff --git a/Resources/Locale/en-US/job/job-names.ftl b/Resources/Locale/en-US/job/job-names.ftl
index 4b7b5ccc421..f5a5f341e5c 100644
--- a/Resources/Locale/en-US/job/job-names.ftl
+++ b/Resources/Locale/en-US/job/job-names.ftl
@@ -47,6 +47,11 @@ job-name-ertjanitor = ERT Janitor
job-name-boxer = Boxer
job-name-zookeeper = Zookeeper
job-name-visitor = Visitor
+# DeltaV - Define senior job names for use in separate prototypes
+job-name-seniorengineer = Senior Engineer
+job-name-seniorphysician = Senior Physician
+job-name-seniorresearcher = Senior Researcher
+job-name-seniorofficer = Senior Officer
# Role timers - Make these alphabetical or I cut you
JobAtmosphericTechnician = Atmospheric Technician
diff --git a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
index 9a3d558a034..6c7d02ad53c 100644
--- a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
+++ b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
@@ -822,6 +822,8 @@
layers:
- state: default
- state: idseniorengineer
+ - type: PresetIdCard # DeltaV - Change senior job titles
+ job: SeniorEngineer
- type: entity
parent: ResearchIDCard
@@ -832,6 +834,8 @@
layers:
- state: default
- state: idseniorresearcher
+ - type: PresetIdCard # DeltaV - Change senior job titles
+ job: SeniorResearcher
- type: entity
parent: MedicalIDCard
@@ -842,6 +846,8 @@
layers:
- state: default
- state: idseniorphysician
+ - type: PresetIdCard # DeltaV - Change senior job titles
+ job: SeniorPhysician
- type: entity
parent: SecurityIDCard
@@ -852,6 +858,8 @@
layers:
- state: default
- state: idseniorofficer
+ - type: PresetIdCard # DeltaV - Change senior job titles
+ job: SeniorOfficer
- type: entity
parent: IDCardStandard
diff --git a/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml b/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
index 15aabc4ab86..cb5cb06bd9f 100644
--- a/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
+++ b/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
@@ -24,3 +24,25 @@
eyes: ClothingEyesGlassesMeson
belt: ClothingBeltUtilityEngineering
ears: ClothingHeadsetEngineering
+
+# DeltaV - Define senior job names as separate prototypes
+- type: job
+ id: SeniorEngineer
+ #parent: StationEngineer # unfortunately parent-child relationships don't seem to work here :blunt:
+ name: job-name-seniorengineer
+ description: job-description-engineer
+ playTimeTracker: JobStationEngineer
+ antagAdvantage: 3
+ requirements:
+ - !type:DepartmentTimeRequirement
+ department: Engineering
+ time: 216000 # 60 hrs
+ startingGear: StationEngineerGear
+ icon: "JobIconSeniorEngineer"
+ supervisors: job-supervisors-ce
+ access:
+ - Maintenance
+ - Engineering
+ - External
+ extendedAccess:
+ - Atmospherics
\ No newline at end of file
diff --git a/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml b/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
index daed73984fe..0acd85638fc 100644
--- a/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
+++ b/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
@@ -22,3 +22,23 @@
equipment:
ears: ClothingHeadsetMedical
belt: ClothingBeltMedicalFilled
+
+- type: job
+ id: SeniorPhysician
+ #parent: MedicalDoctor
+ name: job-name-seniorphysician
+ description: job-description-doctor
+ playTimeTracker: JobMedicalDoctor
+ requirements:
+ - !type:DepartmentTimeRequirement
+ department: Medical
+ time: 216000 # 60 hrs
+ startingGear: DoctorGear
+ icon: "JobIconSeniorPhysician"
+ supervisors: job-supervisors-cmo
+ access:
+ - Medical
+ - Maintenance
+ extendedAccess:
+ - Chemistry
+ - Paramedic
\ No newline at end of file
diff --git a/Resources/Prototypes/Roles/Jobs/Science/scientist.yml b/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
index b005accc79f..2b44a2adfef 100644
--- a/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
+++ b/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
@@ -20,3 +20,21 @@
equipment:
ears: ClothingHeadsetScience
+
+- type: job
+ id: SeniorResearcher
+ #parent: Scientist
+ name: job-name-seniorresearcher
+ description: job-description-scientist
+ playTimeTracker: JobScientist
+ antagAdvantage: 2
+ requirements:
+ - !type:DepartmentTimeRequirement
+ department: Epistemics # DeltaV - Epistemics Department replacing Science
+ time: 216000 # 60 hrs
+ startingGear: ScientistGear
+ icon: "JobIconSeniorResearcher"
+ supervisors: job-supervisors-rd
+ access:
+ - Research
+ - Maintenance
\ No newline at end of file
diff --git a/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml b/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
index 6de806f7189..d204cf3bae3 100644
--- a/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
+++ b/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
@@ -28,3 +28,25 @@
eyes: ClothingEyesGlassesSecurity
ears: ClothingHeadsetSecurity
pocket1: WeaponPistolMk58Nonlethal
+
+- type: job
+ id: SeniorOfficer
+ #parent: SecurityOfficer
+ name: job-name-seniorofficer
+ description: job-description-security
+ playTimeTracker: JobSecurityOfficer
+ requirements:
+ - !type:DepartmentTimeRequirement
+ department: Security
+ time: 216000 # 60 hrs
+ startingGear: SecurityOfficerGear
+ icon: "JobIconSeniorOfficer"
+ supervisors: job-supervisors-hos
+ canBeAntag: false
+ access:
+ - Security
+ - Maintenance
+ - External
+ special:
+ - !type:AddImplantSpecial
+ implants: [ MindShieldImplant ]
\ No newline at end of file
From 1a8f2efd3e4e92e04cc0fb6ec0f65d93ac0ea3d2 Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Fri, 21 Jun 2024 16:00:05 +1000
Subject: [PATCH 4/8] it works!!!
---
.../GameTicking/GameTicker.Spawning.cs | 19 ++++++-------
.../IdentityManagement/IdentitySystem.cs | 2 ++
.../Station/Systems/StationSpawningSystem.cs | 9 +++---
.../Systems/StationRecordsSystem.cs | 13 +++++++--
Content.Shared/Roles/Jobs/JobComponent.cs | 2 ++
Content.Shared/Roles/Jobs/SharedJobSystem.cs | 28 +++++++++++++++----
.../Prototypes/Catalog/uplink_catalog.yml | 4 +--
.../Jobs/Engineering/station_engineer.yml | 2 +-
.../Prototypes/Roles/Jobs/departments.yml | 4 +++
9 files changed, 58 insertions(+), 25 deletions(-)
diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs
index bf0f7785054..a7b5f3d16a1 100644
--- a/Content.Server/GameTicking/GameTicker.Spawning.cs
+++ b/Content.Server/GameTicking/GameTicker.Spawning.cs
@@ -232,10 +232,8 @@ private void SpawnPlayer(ICommonSession player,
_mind.SetUserId(newMind, data.UserId);
var jobPrototype = _prototypeManager.Index(jobId);
+ var job = new JobComponent {Prototype = jobId};
// DeltaV - Senior ID cards
- ProtoId? virtualJobId = null;
- JobPrototype? virtualJobProto = null;
- JobComponent? virtualJob = null;
do
{
var jobLoadout = LoadoutSystem.GetJobPrototype(jobPrototype.ID);
@@ -253,15 +251,14 @@ private void SpawnPlayer(ICommonSession player,
loadout.SetDefault(_prototypeManager);
}
- if (GetVirtualJobFromRoleLoadout(loadout, roleProto, character, out virtualJobId) && _prototypeManager.TryIndex(virtualJobId, out virtualJobProto))
+ if (GetVirtualJobFromRoleLoadout(loadout, roleProto, character, out var virtualJobId) && _prototypeManager.TryIndex(virtualJobId, out var virtualJobProto))
{
- virtualJob = new JobComponent {Prototype = virtualJobId};
+ job.VirtualJob = new JobComponent {Prototype = virtualJobProto};
}
}
while (false);
+ _roles.MindAddRole(newMind, job, silent: silent);
// End of DeltaV code
- var job = new JobComponent {Prototype = jobId};
- _roles.MindAddRole(newMind, virtualJob ?? job, silent: silent);
var jobName = _jobs.MindTryGetJobName(newMind);
_playTimeTrackings.PlayerRolesChanged(player);
@@ -339,7 +336,7 @@ private void SpawnPlayer(ICommonSession player,
PlayersJoinedRoundNormally++;
var aev = new PlayerSpawnCompleteEvent(mob,
player,
- jobId,
+ job,
lateJoin,
PlayersJoinedRoundNormally,
station,
@@ -594,7 +591,7 @@ public sealed class PlayerSpawnCompleteEvent : EntityEventArgs
{
public EntityUid Mob { get; }
public ICommonSession Player { get; }
- public string? JobId { get; }
+ public JobComponent? Job { get; }
public bool LateJoin { get; }
public EntityUid Station { get; }
public HumanoidCharacterProfile Profile { get; }
@@ -604,7 +601,7 @@ public sealed class PlayerSpawnCompleteEvent : EntityEventArgs
public PlayerSpawnCompleteEvent(EntityUid mob,
ICommonSession player,
- string? jobId,
+ JobComponent? job,
bool lateJoin,
int joinOrder,
EntityUid station,
@@ -612,7 +609,7 @@ public PlayerSpawnCompleteEvent(EntityUid mob,
{
Mob = mob;
Player = player;
- JobId = jobId;
+ Job = job;
LateJoin = lateJoin;
Station = station;
Profile = profile;
diff --git a/Content.Server/IdentityManagement/IdentitySystem.cs b/Content.Server/IdentityManagement/IdentitySystem.cs
index 4766b89172f..895bacdc92d 100644
--- a/Content.Server/IdentityManagement/IdentitySystem.cs
+++ b/Content.Server/IdentityManagement/IdentitySystem.cs
@@ -160,12 +160,14 @@ private IdentityRepresentation GetIdentityRepresentation(EntityUid target,
string? presumedJob = null;
string? presumedName = null;
+ string? presumedJobIcon = null;
// Get their name and job from their ID for their presumed name.
if (_idCard.TryFindIdCard(target, out var id))
{
presumedName = string.IsNullOrWhiteSpace(id.Comp.FullName) ? null : id.Comp.FullName;
presumedJob = id.Comp.JobTitle?.ToLowerInvariant();
+ presumedJobIcon = id.Comp.JobIcon;
}
// If it didn't find a job, that's fine.
diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs
index 6cff58338d1..a376315e730 100644
--- a/Content.Server/Station/Systems/StationSpawningSystem.cs
+++ b/Content.Server/Station/Systems/StationSpawningSystem.cs
@@ -144,6 +144,7 @@ public EntityUid SpawnPlayerMob(
EntityUid? entity = null)
{
_prototypeManager.TryIndex(job?.Prototype ?? string.Empty, out var prototype);
+ _prototypeManager.TryIndex(job?.VirtualJob?.Prototype ?? string.Empty, out var virtualJobPrototype); // DeltaV - Senior ID cards
// If we're not spawning a humanoid, we're gonna exit early without doing all the humanoid stuff.
if (prototype?.JobEntity != null)
@@ -212,7 +213,7 @@ public EntityUid SpawnPlayerMob(
if (profile != null)
{
if (prototype != null)
- SetPdaAndIdCardData(entity.Value, profile.Name, prototype, station);
+ SetPdaAndIdCardData(entity.Value, profile.Name, virtualJobPrototype ?? prototype, station); //DeltaV - Senior ID cards
_humanoidSystem.LoadProfile(entity.Value, profile);
_metaSystem.SetEntityName(entity.Value, profile.Name);
@@ -258,10 +259,10 @@ public void SetPdaAndIdCardData(EntityUid entity, string characterName, JobProto
return;
_cardSystem.TryChangeFullName(cardId, characterName, card);
- //_cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card); // Delta V - Senior ID card, job names and icon should already be set via prototype
+ _cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card); // Delta V - Senior ID card, job names and icon should already be set via prototype
- //if (_prototypeManager.TryIndex(jobPrototype.Icon, out var jobIcon))
- // _cardSystem.TryChangeJobIcon(cardId, jobIcon, card);
+ if (_prototypeManager.TryIndex(jobPrototype.Icon, out var jobIcon))
+ _cardSystem.TryChangeJobIcon(cardId, jobIcon, card);
var extendedAccess = false;
if (station != null)
diff --git a/Content.Server/StationRecords/Systems/StationRecordsSystem.cs b/Content.Server/StationRecords/Systems/StationRecordsSystem.cs
index 8c8ba7132bb..9371cd78308 100644
--- a/Content.Server/StationRecords/Systems/StationRecordsSystem.cs
+++ b/Content.Server/StationRecords/Systems/StationRecordsSystem.cs
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Forensics;
using Content.Server.GameTicking;
@@ -5,6 +6,7 @@
using Content.Shared.PDA;
using Content.Shared.Preferences;
using Content.Shared.Roles;
+using Content.Shared.Roles.Jobs;
using Content.Shared.StationRecords;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
@@ -48,12 +50,18 @@ private void OnPlayerSpawn(PlayerSpawnCompleteEvent args)
if (!TryComp(args.Station, out var stationRecords))
return;
- CreateGeneralRecord(args.Station, args.Mob, args.Profile, args.JobId, stationRecords);
+ CreateGeneralRecord(args.Station, args.Mob, args.Profile, args.Job, stationRecords);
}
private void CreateGeneralRecord(EntityUid station, EntityUid player, HumanoidCharacterProfile profile,
- string? jobId, StationRecordsComponent records)
+ JobComponent? job, StationRecordsComponent records)
{
+ _prototypeManager.TryIndex(job?.VirtualJob?.Prototype, out var a);
+ if (!_prototypeManager.TryIndex(job?.Prototype, out var b))
+ return;
+
+ ProtoId jobId = a?.ID ?? b.ID;
+ Log.Debug(jobId);
// TODO make PlayerSpawnCompleteEvent.JobId a ProtoId
if (string.IsNullOrEmpty(jobId)
|| !_prototypeManager.HasIndex(jobId))
@@ -133,6 +141,7 @@ public void CreateGeneralRecord(
Fingerprint = mobFingerprint,
DNA = dna
};
+ Log.Debug($"Record: {record.JobTitle}, {record.JobIcon}, {record.JobPrototype}");
var key = AddRecordEntry(station, record);
if (!key.IsValid())
diff --git a/Content.Shared/Roles/Jobs/JobComponent.cs b/Content.Shared/Roles/Jobs/JobComponent.cs
index 7191e8b3971..d04d7208c0c 100644
--- a/Content.Shared/Roles/Jobs/JobComponent.cs
+++ b/Content.Shared/Roles/Jobs/JobComponent.cs
@@ -11,4 +11,6 @@ public sealed partial class JobComponent : Component
{
[DataField(required: true), AutoNetworkedField]
public ProtoId? Prototype;
+ [DataField]
+ public JobComponent? VirtualJob;
}
diff --git a/Content.Shared/Roles/Jobs/SharedJobSystem.cs b/Content.Shared/Roles/Jobs/SharedJobSystem.cs
index 3e229a5ac57..8b8f043a7cb 100644
--- a/Content.Shared/Roles/Jobs/SharedJobSystem.cs
+++ b/Content.Shared/Roles/Jobs/SharedJobSystem.cs
@@ -120,6 +120,19 @@ public bool MindTryGetJob(
_prototypes.TryIndex(comp.Prototype, out prototype);
}
+ public bool MindTryGetVirtualJob( // DeltaV - Senior ID cards
+ [NotNullWhen(true)] EntityUid? mindId,
+ [NotNullWhen(true)] out JobComponent? comp,
+ [NotNullWhen(true)] out JobPrototype? virtualJob)
+ {
+ comp = null;
+ virtualJob = null;
+
+ return TryComp(mindId, out comp) &&
+ comp.VirtualJob != null &&
+ _prototypes.TryIndex(comp.VirtualJob.Prototype, out virtualJob);
+ }
+
public bool MindTryGetJobId([NotNullWhen(true)] EntityUid? mindId, out ProtoId? job)
{
if (!TryComp(mindId, out JobComponent? comp))
@@ -138,14 +151,19 @@ public bool MindTryGetJobId([NotNullWhen(true)] EntityUid? mindId, out ProtoId
public bool MindTryGetJobName([NotNullWhen(true)] EntityUid? mindId, out string name)
{
- if (MindTryGetJob(mindId, out _, out var prototype))
+ MindTryGetVirtualJob(mindId, out _, out var virtualJob);
+ if (!MindTryGetJob(mindId, out _, out var prototype))
{
- name = prototype.LocalizedName;
- return true;
+ name = Loc.GetString("generic-unknown-title");
+ return false;
}
- name = Loc.GetString("generic-unknown-title");
- return false;
+ name = virtualJob?.LocalizedName ?? string.Empty;
+ if (string.IsNullOrEmpty(name))
+ name = prototype.LocalizedName;
+
+ Log.Debug(name);
+ return true;
}
///
diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml
index 145321484b2..0cf4bef7d2a 100644
--- a/Resources/Prototypes/Catalog/uplink_catalog.yml
+++ b/Resources/Prototypes/Catalog/uplink_catalog.yml
@@ -1392,9 +1392,9 @@
description: uplink-syndicate-stamp-desc
productEntity: RubberStampSyndicate
cost:
- Telecrystal: 2
+ Telecrystal: 1 #DeltaV - Buff Syndicate Stamp cost to be inline with Cybersun Pen
categories:
- - UplinkPointless
+ - UplinkDeception #DeltaV - List Syndicate Stamp as a deception item, MRP
#- type: listing # DeltaV - Remove cat ears
# id: UplinkCatEars
diff --git a/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml b/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml
index b314bebe888..ba0cf1564f7 100644
--- a/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml
+++ b/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml
@@ -16,7 +16,7 @@
requirement:
!type:DepartmentTimeRequirement
department: Engineering
- time: 216000 # 60 hrs
+ time: 0 # 216000 # 60 hrs
# Head
diff --git a/Resources/Prototypes/Roles/Jobs/departments.yml b/Resources/Prototypes/Roles/Jobs/departments.yml
index 5512fb2b330..4393cf8af5c 100644
--- a/Resources/Prototypes/Roles/Jobs/departments.yml
+++ b/Resources/Prototypes/Roles/Jobs/departments.yml
@@ -63,6 +63,7 @@
- ChiefEngineer
- StationEngineer
- TechnicalAssistant
+ - SeniorEngineer # DeltaV - Senior ID cards
- type: department
id: Medical
@@ -76,6 +77,7 @@
- Psychologist
- Paramedic
- MedicalBorg # Delta V - Medical Borg, see Resources/Prototypes/DeltaV/Roles/Jobs/Medical/medicalborg.yml
+ - SeniorPhysician # DeltaV - Senior ID cards
- type: department
id: Security
@@ -90,6 +92,7 @@
- Warden
- PrisonGuard # Nyanotrasen - PrisonGuard, see Resources/Prototypes/Nyanotrasen/Roles/Jobs/Security/prisonguard.yml
- Brigmedic # DeltaV - Brigmedic, see Resources/Prototypes/DeltaV/Roles/Jobs/Security/brigmedic.yml
+ - SeniorOfficer # DeltaV - Senior ID cards
- type: department
id: Epistemics # DeltaV - Epistemics Department replacing Science
@@ -101,6 +104,7 @@
- ResearchAssistant
- Chaplain # DeltaV - Move Chaplain into Epistemics
- ForensicMantis # Nyanotrasen - ForensicMantis, see Resources/Prototypes/Nyanotrasen/Roles/Jobs/Epistemics/forensicmantis.yml
+ - SeniorResearcher # DeltaV - Senior ID cards
- type: department
id: Specific
From 3a39ac86f4bc663cdf2ed10fceec251ef283ec46 Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Fri, 21 Jun 2024 19:37:58 +1000
Subject: [PATCH 5/8] revert accidental changes
---
Content.Server/IdentityManagement/IdentitySystem.cs | 2 --
Resources/Prototypes/Catalog/uplink_catalog.yml | 4 ++--
.../Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml | 2 +-
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/Content.Server/IdentityManagement/IdentitySystem.cs b/Content.Server/IdentityManagement/IdentitySystem.cs
index 895bacdc92d..4766b89172f 100644
--- a/Content.Server/IdentityManagement/IdentitySystem.cs
+++ b/Content.Server/IdentityManagement/IdentitySystem.cs
@@ -160,14 +160,12 @@ private IdentityRepresentation GetIdentityRepresentation(EntityUid target,
string? presumedJob = null;
string? presumedName = null;
- string? presumedJobIcon = null;
// Get their name and job from their ID for their presumed name.
if (_idCard.TryFindIdCard(target, out var id))
{
presumedName = string.IsNullOrWhiteSpace(id.Comp.FullName) ? null : id.Comp.FullName;
presumedJob = id.Comp.JobTitle?.ToLowerInvariant();
- presumedJobIcon = id.Comp.JobIcon;
}
// If it didn't find a job, that's fine.
diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml
index 0cf4bef7d2a..145321484b2 100644
--- a/Resources/Prototypes/Catalog/uplink_catalog.yml
+++ b/Resources/Prototypes/Catalog/uplink_catalog.yml
@@ -1392,9 +1392,9 @@
description: uplink-syndicate-stamp-desc
productEntity: RubberStampSyndicate
cost:
- Telecrystal: 1 #DeltaV - Buff Syndicate Stamp cost to be inline with Cybersun Pen
+ Telecrystal: 2
categories:
- - UplinkDeception #DeltaV - List Syndicate Stamp as a deception item, MRP
+ - UplinkPointless
#- type: listing # DeltaV - Remove cat ears
# id: UplinkCatEars
diff --git a/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml b/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml
index ba0cf1564f7..b314bebe888 100644
--- a/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml
+++ b/Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml
@@ -16,7 +16,7 @@
requirement:
!type:DepartmentTimeRequirement
department: Engineering
- time: 0 # 216000 # 60 hrs
+ time: 216000 # 60 hrs
# Head
From 88ca963522d27fd7e6ebf6202a0ccab8847f3692 Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Fri, 21 Jun 2024 21:30:54 +1000
Subject: [PATCH 6/8] hide senior virtual job prototypes from job select
---
Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs | 3 +++
Content.Shared/Roles/JobPrototype.cs | 3 +++
.../Prototypes/Roles/Jobs/Engineering/station_engineer.yml | 1 +
Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml | 1 +
Resources/Prototypes/Roles/Jobs/Science/scientist.yml | 1 +
Resources/Prototypes/Roles/Jobs/Security/security_officer.yml | 1 +
6 files changed, 10 insertions(+)
diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
index ec4701dbe31..d71dc552b4d 100644
--- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
+++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
@@ -851,6 +851,9 @@ public void RefreshJobs()
foreach (var job in jobs)
{
+ if (job.EditorHidden)
+ continue;
+
var jobContainer = new BoxContainer()
{
Orientation = LayoutOrientation.Horizontal,
diff --git a/Content.Shared/Roles/JobPrototype.cs b/Content.Shared/Roles/JobPrototype.cs
index 71bd41c89fb..3d62e03e256 100644
--- a/Content.Shared/Roles/JobPrototype.cs
+++ b/Content.Shared/Roles/JobPrototype.cs
@@ -123,6 +123,9 @@ public sealed partial class JobPrototype : IPrototype
[DataField]
public bool Whitelisted;
+
+ [DataField]
+ public bool EditorHidden;
}
///
diff --git a/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml b/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
index cb5cb06bd9f..306d5380147 100644
--- a/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
+++ b/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
@@ -29,6 +29,7 @@
- type: job
id: SeniorEngineer
#parent: StationEngineer # unfortunately parent-child relationships don't seem to work here :blunt:
+ editorHidden: true
name: job-name-seniorengineer
description: job-description-engineer
playTimeTracker: JobStationEngineer
diff --git a/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml b/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
index 0acd85638fc..765bd00953e 100644
--- a/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
+++ b/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
@@ -26,6 +26,7 @@
- type: job
id: SeniorPhysician
#parent: MedicalDoctor
+ editorHidden: true
name: job-name-seniorphysician
description: job-description-doctor
playTimeTracker: JobMedicalDoctor
diff --git a/Resources/Prototypes/Roles/Jobs/Science/scientist.yml b/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
index 2b44a2adfef..dba8ad58ce5 100644
--- a/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
+++ b/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
@@ -24,6 +24,7 @@
- type: job
id: SeniorResearcher
#parent: Scientist
+ editorHidden: true
name: job-name-seniorresearcher
description: job-description-scientist
playTimeTracker: JobScientist
diff --git a/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml b/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
index d204cf3bae3..4904a07217b 100644
--- a/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
+++ b/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
@@ -32,6 +32,7 @@
- type: job
id: SeniorOfficer
#parent: SecurityOfficer
+ editorHidden: true
name: job-name-seniorofficer
description: job-description-security
playTimeTracker: JobSecurityOfficer
From 89cee692441255c2b234a629703a3f8ff0355b15 Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Fri, 21 Jun 2024 21:33:48 +1000
Subject: [PATCH 7/8] remove whitespace diff
---
Content.Server/Access/Systems/PresetIdCardSystem.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/Content.Server/Access/Systems/PresetIdCardSystem.cs b/Content.Server/Access/Systems/PresetIdCardSystem.cs
index 0983e501a4d..719d61b356a 100644
--- a/Content.Server/Access/Systems/PresetIdCardSystem.cs
+++ b/Content.Server/Access/Systems/PresetIdCardSystem.cs
@@ -15,7 +15,6 @@ public sealed class PresetIdCardSystem : EntitySystem
[Dependency] private readonly IdCardSystem _cardSystem = default!;
[Dependency] private readonly SharedAccessSystem _accessSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
-
public override void Initialize()
{
SubscribeLocalEvent(OnMapInit);
From bfb1187719f688dbc0134d02a625630149775131 Mon Sep 17 00:00:00 2001
From: WarMechanic <69510347+WarMechanic@users.noreply.github.com>
Date: Fri, 21 Jun 2024 21:59:25 +1000
Subject: [PATCH 8/8] consolidate comments
---
.../Lobby/UI/HumanoidProfileEditor.xaml.cs | 1 +
.../GameTicking/GameTicker.Spawning.cs | 16 +++++++++-------
.../Station/Systems/StationSpawningSystem.cs | 6 +++---
.../Systems/StationRecordsSystem.cs | 10 +++++-----
Content.Shared/Roles/JobPrototype.cs | 1 +
Content.Shared/Roles/Jobs/JobComponent.cs | 2 ++
Content.Shared/Roles/Jobs/SharedJobSystem.cs | 6 +++++-
Resources/Locale/en-US/job/job-names.ftl | 2 +-
.../Objects/Misc/identification_cards.yml | 16 ++++++++--------
.../Roles/Jobs/Engineering/station_engineer.yml | 4 ++--
.../Roles/Jobs/Medical/medical_doctor.yml | 3 ++-
.../Prototypes/Roles/Jobs/Science/scientist.yml | 4 ++--
.../Roles/Jobs/Security/security_officer.yml | 3 ++-
Resources/Prototypes/Roles/Jobs/departments.yml | 8 ++++----
14 files changed, 47 insertions(+), 35 deletions(-)
diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
index d71dc552b4d..5b6cbf46283 100644
--- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
+++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
@@ -851,6 +851,7 @@ public void RefreshJobs()
foreach (var job in jobs)
{
+ // DeltaV #1418 - Allow hiding jobs to hide senior virtual jobs
if (job.EditorHidden)
continue;
diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs
index a7b5f3d16a1..c842db1c005 100644
--- a/Content.Server/GameTicking/GameTicker.Spawning.cs
+++ b/Content.Server/GameTicking/GameTicker.Spawning.cs
@@ -36,7 +36,7 @@ public sealed partial class GameTicker
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!;
- [Dependency] private readonly IComponentFactory _componentFactory = default!;
+ [Dependency] private readonly IComponentFactory _componentFactory = default!; // DeltaV #1418
[ValidatePrototypeId]
public const string ObserverPrototypeName = "MobObserver";
@@ -233,7 +233,8 @@ private void SpawnPlayer(ICommonSession player,
var jobPrototype = _prototypeManager.Index(jobId);
var job = new JobComponent {Prototype = jobId};
- // DeltaV - Senior ID cards
+ // DeltaV #1418 - Loadout stuff to get Senior ID
+ // We don't want to inherit everything, so we store the job component in a VirtualJob
do
{
var jobLoadout = LoadoutSystem.GetJobPrototype(jobPrototype.ID);
@@ -251,14 +252,15 @@ private void SpawnPlayer(ICommonSession player,
loadout.SetDefault(_prototypeManager);
}
+ // Get the ID
if (GetVirtualJobFromRoleLoadout(loadout, roleProto, character, out var virtualJobId) && _prototypeManager.TryIndex(virtualJobId, out var virtualJobProto))
{
job.VirtualJob = new JobComponent {Prototype = virtualJobProto};
}
}
while (false);
- _roles.MindAddRole(newMind, job, silent: silent);
// End of DeltaV code
+ _roles.MindAddRole(newMind, job, silent: silent);
var jobName = _jobs.MindTryGetJobName(newMind);
_playTimeTrackings.PlayerRolesChanged(player);
@@ -344,7 +346,7 @@ private void SpawnPlayer(ICommonSession player,
RaiseLocalEvent(mob, aev, true);
}
- // DeltaV - Senior ID cards
+ // DeltaV #1418 - Go through loadout items to find ID card and its attached job
private bool GetVirtualJobFromRoleLoadout(RoleLoadout loadout, RoleLoadoutPrototype roleProto, HumanoidCharacterProfile character, out ProtoId? virtualJob)
{
virtualJob = null;
@@ -591,7 +593,7 @@ public sealed class PlayerSpawnCompleteEvent : EntityEventArgs
{
public EntityUid Mob { get; }
public ICommonSession Player { get; }
- public JobComponent? Job { get; }
+ public JobComponent? Job { get; } // DeltaV #1418 - Replace JobId with Job to parse VirtualJob
public bool LateJoin { get; }
public EntityUid Station { get; }
public HumanoidCharacterProfile Profile { get; }
@@ -601,7 +603,7 @@ public sealed class PlayerSpawnCompleteEvent : EntityEventArgs
public PlayerSpawnCompleteEvent(EntityUid mob,
ICommonSession player,
- JobComponent? job,
+ JobComponent? job, // DeltaV #1418
bool lateJoin,
int joinOrder,
EntityUid station,
@@ -609,7 +611,7 @@ public PlayerSpawnCompleteEvent(EntityUid mob,
{
Mob = mob;
Player = player;
- Job = job;
+ Job = job; // DeltaV #1418
LateJoin = lateJoin;
Station = station;
Profile = profile;
diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs
index a376315e730..0b9427e66f4 100644
--- a/Content.Server/Station/Systems/StationSpawningSystem.cs
+++ b/Content.Server/Station/Systems/StationSpawningSystem.cs
@@ -144,7 +144,7 @@ public EntityUid SpawnPlayerMob(
EntityUid? entity = null)
{
_prototypeManager.TryIndex(job?.Prototype ?? string.Empty, out var prototype);
- _prototypeManager.TryIndex(job?.VirtualJob?.Prototype ?? string.Empty, out var virtualJobPrototype); // DeltaV - Senior ID cards
+ _prototypeManager.TryIndex(job?.VirtualJob?.Prototype ?? string.Empty, out var virtualJobPrototype); // DeltaV #1418 - Get the VirtualJob too
// If we're not spawning a humanoid, we're gonna exit early without doing all the humanoid stuff.
if (prototype?.JobEntity != null)
@@ -213,7 +213,7 @@ public EntityUid SpawnPlayerMob(
if (profile != null)
{
if (prototype != null)
- SetPdaAndIdCardData(entity.Value, profile.Name, virtualJobPrototype ?? prototype, station); //DeltaV - Senior ID cards
+ SetPdaAndIdCardData(entity.Value, profile.Name, virtualJobPrototype ?? prototype, station); // DeltaV #1418 - Inherit job data from a VirtualJob if one exists
_humanoidSystem.LoadProfile(entity.Value, profile);
_metaSystem.SetEntityName(entity.Value, profile.Name);
@@ -259,7 +259,7 @@ public void SetPdaAndIdCardData(EntityUid entity, string characterName, JobProto
return;
_cardSystem.TryChangeFullName(cardId, characterName, card);
- _cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card); // Delta V - Senior ID card, job names and icon should already be set via prototype
+ _cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card);
if (_prototypeManager.TryIndex(jobPrototype.Icon, out var jobIcon))
_cardSystem.TryChangeJobIcon(cardId, jobIcon, card);
diff --git a/Content.Server/StationRecords/Systems/StationRecordsSystem.cs b/Content.Server/StationRecords/Systems/StationRecordsSystem.cs
index 9371cd78308..ffe97963e38 100644
--- a/Content.Server/StationRecords/Systems/StationRecordsSystem.cs
+++ b/Content.Server/StationRecords/Systems/StationRecordsSystem.cs
@@ -50,19 +50,20 @@ private void OnPlayerSpawn(PlayerSpawnCompleteEvent args)
if (!TryComp(args.Station, out var stationRecords))
return;
- CreateGeneralRecord(args.Station, args.Mob, args.Profile, args.Job, stationRecords);
+ CreateGeneralRecord(args.Station, args.Mob, args.Profile, args.Job, stationRecords); // DeltaV #1418 - JobId replaced with Job to parse VirtualJob
}
private void CreateGeneralRecord(EntityUid station, EntityUid player, HumanoidCharacterProfile profile,
- JobComponent? job, StationRecordsComponent records)
+ JobComponent? job, StationRecordsComponent records) // DeltaV #1418
{
+ // DeltaV #1418 - Inherit from VirtualJob if possible
_prototypeManager.TryIndex(job?.VirtualJob?.Prototype, out var a);
if (!_prototypeManager.TryIndex(job?.Prototype, out var b))
return;
ProtoId jobId = a?.ID ?? b.ID;
- Log.Debug(jobId);
- // TODO make PlayerSpawnCompleteEvent.JobId a ProtoId
+ // TODO make PlayerSpawnCompleteEvent.JobId a ProtoId // DeltaV #1418 - :blunt:
+ // End of DeltaV code
if (string.IsNullOrEmpty(jobId)
|| !_prototypeManager.HasIndex(jobId))
return;
@@ -141,7 +142,6 @@ public void CreateGeneralRecord(
Fingerprint = mobFingerprint,
DNA = dna
};
- Log.Debug($"Record: {record.JobTitle}, {record.JobIcon}, {record.JobPrototype}");
var key = AddRecordEntry(station, record);
if (!key.IsValid())
diff --git a/Content.Shared/Roles/JobPrototype.cs b/Content.Shared/Roles/JobPrototype.cs
index 3d62e03e256..eafc1c21c79 100644
--- a/Content.Shared/Roles/JobPrototype.cs
+++ b/Content.Shared/Roles/JobPrototype.cs
@@ -124,6 +124,7 @@ public sealed partial class JobPrototype : IPrototype
[DataField]
public bool Whitelisted;
+ // DeltaV #1418 - Allow hiding virtual jobs like the senior job prototypes
[DataField]
public bool EditorHidden;
}
diff --git a/Content.Shared/Roles/Jobs/JobComponent.cs b/Content.Shared/Roles/Jobs/JobComponent.cs
index d04d7208c0c..b7802f76813 100644
--- a/Content.Shared/Roles/Jobs/JobComponent.cs
+++ b/Content.Shared/Roles/Jobs/JobComponent.cs
@@ -11,6 +11,8 @@ public sealed partial class JobComponent : Component
{
[DataField(required: true), AutoNetworkedField]
public ProtoId? Prototype;
+
+ // DeltaV #1418 - Inherit job prototype information from a loadout-specified ID
[DataField]
public JobComponent? VirtualJob;
}
diff --git a/Content.Shared/Roles/Jobs/SharedJobSystem.cs b/Content.Shared/Roles/Jobs/SharedJobSystem.cs
index 8b8f043a7cb..d7235330986 100644
--- a/Content.Shared/Roles/Jobs/SharedJobSystem.cs
+++ b/Content.Shared/Roles/Jobs/SharedJobSystem.cs
@@ -39,7 +39,7 @@ private void SetupTrackerLookup()
// This breaks if you have N trackers to 1 JobId but future concern.
foreach (var job in _protoManager.EnumeratePrototypes())
{
- if (_inverseTrackerLookup.ContainsKey(job.PlayTimeTracker)) continue; // DeltaV - we have N trackers to 1 JobId... (senior job names)
+ if (_inverseTrackerLookup.ContainsKey(job.PlayTimeTracker)) continue; // DeltaV #1418 - we have N trackers to 1 JobId... (senior job prototypes)
_inverseTrackerLookup.Add(job.PlayTimeTracker, job.ID);
}
@@ -120,6 +120,7 @@ public bool MindTryGetJob(
_prototypes.TryIndex(comp.Prototype, out prototype);
}
+ // DeltaV #1418 - lazy copy paste, nothing ground-breaking
public bool MindTryGetVirtualJob( // DeltaV - Senior ID cards
[NotNullWhen(true)] EntityUid? mindId,
[NotNullWhen(true)] out JobComponent? comp,
@@ -132,6 +133,7 @@ public bool MindTryGetVirtualJob( // DeltaV - Senior ID cards
comp.VirtualJob != null &&
_prototypes.TryIndex(comp.VirtualJob.Prototype, out virtualJob);
}
+ // End of DeltaV code
public bool MindTryGetJobId([NotNullWhen(true)] EntityUid? mindId, out ProtoId? job)
{
@@ -151,6 +153,7 @@ public bool MindTryGetJobId([NotNullWhen(true)] EntityUid? mindId, out ProtoId
public bool MindTryGetJobName([NotNullWhen(true)] EntityUid? mindId, out string name)
{
+ // DeltaV #1418 - Try to get the VirtualJob, and return if we don't have an actual job
MindTryGetVirtualJob(mindId, out _, out var virtualJob);
if (!MindTryGetJob(mindId, out _, out var prototype))
{
@@ -164,6 +167,7 @@ public bool MindTryGetJobName([NotNullWhen(true)] EntityUid? mindId, out string
Log.Debug(name);
return true;
+ // End of DeltaV code
}
///
diff --git a/Resources/Locale/en-US/job/job-names.ftl b/Resources/Locale/en-US/job/job-names.ftl
index f5a5f341e5c..645a05578fb 100644
--- a/Resources/Locale/en-US/job/job-names.ftl
+++ b/Resources/Locale/en-US/job/job-names.ftl
@@ -47,7 +47,7 @@ job-name-ertjanitor = ERT Janitor
job-name-boxer = Boxer
job-name-zookeeper = Zookeeper
job-name-visitor = Visitor
-# DeltaV - Define senior job names for use in separate prototypes
+# DeltaV #1418 - Define senior job names for use in job prototypes
job-name-seniorengineer = Senior Engineer
job-name-seniorphysician = Senior Physician
job-name-seniorresearcher = Senior Researcher
diff --git a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
index 6c7d02ad53c..1b29c7dc7e1 100644
--- a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
+++ b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml
@@ -822,8 +822,8 @@
layers:
- state: default
- state: idseniorengineer
- - type: PresetIdCard # DeltaV - Change senior job titles
- job: SeniorEngineer
+ - type: PresetIdCard
+ job: SeniorEngineer # DeltaV #1418 - Change senior job titles
- type: entity
parent: ResearchIDCard
@@ -834,8 +834,8 @@
layers:
- state: default
- state: idseniorresearcher
- - type: PresetIdCard # DeltaV - Change senior job titles
- job: SeniorResearcher
+ - type: PresetIdCard
+ job: SeniorResearcher # DeltaV #1418
- type: entity
parent: MedicalIDCard
@@ -846,8 +846,8 @@
layers:
- state: default
- state: idseniorphysician
- - type: PresetIdCard # DeltaV - Change senior job titles
- job: SeniorPhysician
+ - type: PresetIdCard
+ job: SeniorPhysician # DeltaV #1418
- type: entity
parent: SecurityIDCard
@@ -858,8 +858,8 @@
layers:
- state: default
- state: idseniorofficer
- - type: PresetIdCard # DeltaV - Change senior job titles
- job: SeniorOfficer
+ - type: PresetIdCard
+ job: SeniorOfficer # DeltaV #1418
- type: entity
parent: IDCardStandard
diff --git a/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml b/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
index 306d5380147..8d7a4f85cc4 100644
--- a/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
+++ b/Resources/Prototypes/Roles/Jobs/Engineering/station_engineer.yml
@@ -25,10 +25,10 @@
belt: ClothingBeltUtilityEngineering
ears: ClothingHeadsetEngineering
-# DeltaV - Define senior job names as separate prototypes
+# DeltaV #1418 - Define senior job names as separate prototypes
- type: job
id: SeniorEngineer
- #parent: StationEngineer # unfortunately parent-child relationships don't seem to work here :blunt:
+ #parent: StationEngineer # So sad parent-child relationships don't seem to work here
editorHidden: true
name: job-name-seniorengineer
description: job-description-engineer
diff --git a/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml b/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
index 765bd00953e..f2b4d3ad90a 100644
--- a/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
+++ b/Resources/Prototypes/Roles/Jobs/Medical/medical_doctor.yml
@@ -23,9 +23,10 @@
ears: ClothingHeadsetMedical
belt: ClothingBeltMedicalFilled
+# DeltaV #1418 - Define senior job names as separate prototypes
- type: job
id: SeniorPhysician
- #parent: MedicalDoctor
+ #parent: MedicalDoctor # So sad parent-child relationships don't seem to work here
editorHidden: true
name: job-name-seniorphysician
description: job-description-doctor
diff --git a/Resources/Prototypes/Roles/Jobs/Science/scientist.yml b/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
index dba8ad58ce5..fc1ccf3e270 100644
--- a/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
+++ b/Resources/Prototypes/Roles/Jobs/Science/scientist.yml
@@ -20,10 +20,10 @@
equipment:
ears: ClothingHeadsetScience
-
+# DeltaV #1418 - Define senior job names as separate prototypes
- type: job
id: SeniorResearcher
- #parent: Scientist
+ #parent: Scientist # So sad parent-child relationships don't seem to work here
editorHidden: true
name: job-name-seniorresearcher
description: job-description-scientist
diff --git a/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml b/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
index 4904a07217b..d1c503f7120 100644
--- a/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
+++ b/Resources/Prototypes/Roles/Jobs/Security/security_officer.yml
@@ -29,9 +29,10 @@
ears: ClothingHeadsetSecurity
pocket1: WeaponPistolMk58Nonlethal
+# DeltaV #1418 - Define senior job names as separate prototypes
- type: job
id: SeniorOfficer
- #parent: SecurityOfficer
+ #parent: SecurityOfficer # So sad parent-child relationships don't seem to work here
editorHidden: true
name: job-name-seniorofficer
description: job-description-security
diff --git a/Resources/Prototypes/Roles/Jobs/departments.yml b/Resources/Prototypes/Roles/Jobs/departments.yml
index 4393cf8af5c..5b7f571f917 100644
--- a/Resources/Prototypes/Roles/Jobs/departments.yml
+++ b/Resources/Prototypes/Roles/Jobs/departments.yml
@@ -63,7 +63,7 @@
- ChiefEngineer
- StationEngineer
- TechnicalAssistant
- - SeniorEngineer # DeltaV - Senior ID cards
+ - SeniorEngineer # DeltaV #1418 - Senior ID cards
- type: department
id: Medical
@@ -77,7 +77,7 @@
- Psychologist
- Paramedic
- MedicalBorg # Delta V - Medical Borg, see Resources/Prototypes/DeltaV/Roles/Jobs/Medical/medicalborg.yml
- - SeniorPhysician # DeltaV - Senior ID cards
+ - SeniorPhysician # DeltaV #1418 - Senior ID cards
- type: department
id: Security
@@ -92,7 +92,7 @@
- Warden
- PrisonGuard # Nyanotrasen - PrisonGuard, see Resources/Prototypes/Nyanotrasen/Roles/Jobs/Security/prisonguard.yml
- Brigmedic # DeltaV - Brigmedic, see Resources/Prototypes/DeltaV/Roles/Jobs/Security/brigmedic.yml
- - SeniorOfficer # DeltaV - Senior ID cards
+ - SeniorOfficer # DeltaV #1418 - Senior ID cards
- type: department
id: Epistemics # DeltaV - Epistemics Department replacing Science
@@ -104,7 +104,7 @@
- ResearchAssistant
- Chaplain # DeltaV - Move Chaplain into Epistemics
- ForensicMantis # Nyanotrasen - ForensicMantis, see Resources/Prototypes/Nyanotrasen/Roles/Jobs/Epistemics/forensicmantis.yml
- - SeniorResearcher # DeltaV - Senior ID cards
+ - SeniorResearcher # DeltaV #1418 - Senior ID cards
- type: department
id: Specific