Remove duplicate data from preset ID cards.
It is now fetched from the corresponding job.
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
using Content.Shared.Jobs;
|
||||||
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.Components.Access
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
public class PresetIdCardComponent : Component, IMapInit
|
||||||
|
{
|
||||||
|
public override string Name => "PresetIdCard";
|
||||||
|
|
||||||
|
private string? _jobName;
|
||||||
|
|
||||||
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
{
|
||||||
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
serializer.DataField(ref _jobName, "job", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IMapInit.MapInit()
|
||||||
|
{
|
||||||
|
if (_jobName == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var prototypes = IoCManager.Resolve<IPrototypeManager>();
|
||||||
|
var job = prototypes.Index<JobPrototype>(_jobName);
|
||||||
|
var access = Owner.GetComponent<AccessComponent>();
|
||||||
|
var idCard = Owner.GetComponent<IdCardComponent>();
|
||||||
|
|
||||||
|
access.SetTags(job.Access);
|
||||||
|
idCard.JobTitle = job.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
- idcard
|
- idcard
|
||||||
sprite: Clothing/id_cards.rsi
|
sprite: Clothing/id_cards.rsi
|
||||||
HeldPrefix: default
|
HeldPrefix: default
|
||||||
|
- type: Access
|
||||||
|
- type: IdCard
|
||||||
|
|
||||||
#IDs with layers
|
#IDs with layers
|
||||||
|
|
||||||
@@ -29,10 +31,8 @@
|
|||||||
- state: idassistant
|
- state: idassistant
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: default
|
state: default
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Assistant
|
job: Assistant
|
||||||
- type: Access
|
|
||||||
tags: ["Maintenance", "Service"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -48,10 +48,8 @@
|
|||||||
state: gold
|
state: gold
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
HeldPrefix: gold
|
HeldPrefix: gold
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Captain
|
job: Captain
|
||||||
- type: Access
|
|
||||||
tags: ["Maintenance", "Cargo", "Engineering", "Medical", "Research", "Security", "Service", "Captain", "Command", "External", "HeadOfPersonnel"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -65,10 +63,8 @@
|
|||||||
- state: idsecurityofficer
|
- state: idsecurityofficer
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idsecurityofficer
|
state: idsecurityofficer
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Security Officer
|
job: SecurityOfficer
|
||||||
- type: Access
|
|
||||||
tags: ["Security", "Maintenance", "Service"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -82,10 +78,8 @@
|
|||||||
- state: idstationengineer
|
- state: idstationengineer
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idstationengineer
|
state: idstationengineer
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Engineer
|
job: StationEngineer
|
||||||
- type: Access
|
|
||||||
tags: ["Engineering", "Maintenance", "External"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -99,10 +93,8 @@
|
|||||||
- state: idmedicaldoctor
|
- state: idmedicaldoctor
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idmedicaldoctor
|
state: idmedicaldoctor
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Doctor
|
job: MedicalDoctor
|
||||||
- type: Access
|
|
||||||
tags: ["Medical"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -116,10 +108,8 @@
|
|||||||
- state: idcargotechnician
|
- state: idcargotechnician
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idcargotechnician
|
state: idcargotechnician
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Cargo Technician
|
job: CargoTechnician
|
||||||
- type: Access
|
|
||||||
tags: ["Cargo", "Maintenance"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -133,10 +123,8 @@
|
|||||||
- state: idscientist
|
- state: idscientist
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idscientist
|
state: idscientist
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Scientist
|
job: Scientist
|
||||||
- type: Access
|
|
||||||
tags: ["Research"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -150,10 +138,8 @@
|
|||||||
- state: idclown
|
- state: idclown
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idclown
|
state: idclown
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Clown
|
job: Clown
|
||||||
- type: Access
|
|
||||||
tags: ["Maintenance", "Service"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -167,10 +153,8 @@
|
|||||||
- state: idjanitor
|
- state: idjanitor
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idjanitor
|
state: idjanitor
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Janitor
|
job: Janitor
|
||||||
- type: Access
|
|
||||||
tags: ["Maintenance", "Service"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -184,10 +168,8 @@
|
|||||||
- state: idbartender
|
- state: idbartender
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idbartender
|
state: idbartender
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Bartender
|
job: Bartender
|
||||||
- type: Access
|
|
||||||
tags: ["Service"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -201,10 +183,8 @@
|
|||||||
- state: idcook
|
- state: idcook
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: idcook
|
state: idcook
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Chef
|
job: Chef
|
||||||
- type: Access
|
|
||||||
tags: ["Maintenance", "Service"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -220,10 +200,8 @@
|
|||||||
state: idheadofpersonnel
|
state: idheadofpersonnel
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
HeldPrefix: silver
|
HeldPrefix: silver
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Head of Personnel
|
job: HeadOfPersonnel
|
||||||
- type: Access
|
|
||||||
tags: ["Maintenance", "Cargo", "Security", "Service", "Command", "HeadOfPersonnel", "Janitor"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -239,10 +217,8 @@
|
|||||||
state: idchiefengineer
|
state: idchiefengineer
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
HeldPrefix: silver
|
HeldPrefix: silver
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Chief Engineer
|
job: ChiefEngineer
|
||||||
- type: Access
|
|
||||||
tags: ["Engineering", "Command", "Maintenance", "External"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -258,10 +234,8 @@
|
|||||||
state: idchiefmedicalofficer
|
state: idchiefmedicalofficer
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
HeldPrefix: silver
|
HeldPrefix: silver
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Chief Medical Officer
|
job: ChiefMedicalOfficer
|
||||||
- type: Access
|
|
||||||
tags: ["Medical", "Command", "Maintenance"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -277,10 +251,8 @@
|
|||||||
state: idresearchdirector
|
state: idresearchdirector
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
HeldPrefix: silver
|
HeldPrefix: silver
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Research Director
|
job: ResearchDirector
|
||||||
- type: Access
|
|
||||||
tags: ["Research", "Command", "Maintenance"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -296,10 +268,8 @@
|
|||||||
state: idheadofsecurity
|
state: idheadofsecurity
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
HeldPrefix: silver
|
HeldPrefix: silver
|
||||||
- type: IdCard
|
- type: PresetIdCard
|
||||||
jobTitle: Head of Security
|
job: HeadOfSecurity
|
||||||
- type: Access
|
|
||||||
tags: ["Security", "Maintenance", "Service", "Command"]
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: IDCardStandard
|
parent: IDCardStandard
|
||||||
@@ -318,4 +288,4 @@
|
|||||||
- type: IdCard
|
- type: IdCard
|
||||||
jobTitle: Central Commander
|
jobTitle: Central Commander
|
||||||
- type: Access
|
- type: Access
|
||||||
tags: ["Maintenance", "Cargo", "Engineering", "Medical", "Research", "Security", "Service", "Captain", "Command", "External", "HeadOfPersonnel"]
|
tags: ["Maintenance", "Cargo", "Engineering", "Medical", "Research", "Security", "Service", "Captain", "Command", "External", "HeadOfPersonnel", "Janitor", "Theatre"]
|
||||||
|
|||||||
Reference in New Issue
Block a user