From 02fbc5938b380e4c8c6302f643d1ede8ccaca2c6 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 19 Jan 2020 18:31:14 +0100 Subject: [PATCH] Adds more metadata to job prototypes: Whether the job is a head. The access levels the job has. The total & spawn positions count. --- Content.Shared/Jobs/JobPrototype.cs | 56 ++++++++++++++++++- .../Prototypes/Jobs/Cargo/CargoTechnician.yml | 4 +- .../Prototypes/Jobs/Civilian/Assistant.yml | 4 ++ Resources/Prototypes/Jobs/Civilian/Clown.yml | 9 +++ .../Prototypes/Jobs/Civilian/Janitor.yml | 7 ++- Resources/Prototypes/Jobs/Command/Captain.yml | 18 +++++- .../Jobs/Command/HeadOfPersonnel.yml | 13 ++++- .../Jobs/Engineering/ChiefEngineer.yml | 9 ++- .../Prototypes/Jobs/Engineering/Engineer.yml | 6 ++ .../Jobs/Medical/ChiefMedicalOfficer.yml | 8 ++- .../Prototypes/Jobs/Medical/MedicalDoctor.yml | 7 ++- .../Jobs/Science/ResearchDirector.yml | 8 ++- .../Prototypes/Jobs/Science/Scientist.yml | 7 ++- .../Jobs/Security/HeadOfSecurity.yml | 9 ++- .../Jobs/Security/SecurityOfficer.yml | 8 ++- 15 files changed, 159 insertions(+), 14 deletions(-) diff --git a/Content.Shared/Jobs/JobPrototype.cs b/Content.Shared/Jobs/JobPrototype.cs index 5a6c47ad1b..2092b45b94 100644 --- a/Content.Shared/Jobs/JobPrototype.cs +++ b/Content.Shared/Jobs/JobPrototype.cs @@ -1,27 +1,77 @@ using System; using System.Collections.Generic; using System.Linq; +using Robust.Shared.Localization; using Robust.Shared.Prototypes; using Robust.Shared.Utility; using YamlDotNet.RepresentationModel; namespace Content.Shared.Jobs { + /// + /// Describes information for a single job on the station. + /// [Prototype("job")] public class JobPrototype : IPrototype, IIndexedPrototype { public string ID { get; private set; } + + /// + /// The name of this job as displayed to players. + /// public string Name { get; private set; } + /// + /// Whether this job is a head. + /// The job system will try to pick heads before other jobs on the same priority level. + /// + public bool IsHead { get; private set; } + + /// + /// The total amount of people that can start with this job round-start. + /// + public int SpawnPositions { get; private set; } + + /// + /// The total amount of positions available. + /// + public int TotalPositions { get; private set; } + public string StartingGear { get; private set; } - public IEnumerable Department { get; private set; } + + public IReadOnlyCollection Department { get; private set; } + public IReadOnlyCollection Access { get; private set; } public void LoadFrom(YamlMappingNode mapping) { ID = mapping.GetNode("id").AsString(); - Name = mapping.GetNode("name").ToString(); + Name = Loc.GetString(mapping.GetNode("name").ToString()); StartingGear = mapping.GetNode("startingGear").ToString(); - Department = mapping.GetNode("department").AllNodes.Select(i => i.ToString()); + Department = mapping.GetNode("department").AllNodes.Select(i => i.ToString()).ToList(); + TotalPositions = mapping.GetNode("positions").AsInt(); + + if (mapping.TryGetNode("spawnPositions", out var positionsNode)) + { + SpawnPositions = positionsNode.AsInt(); + } + else + { + SpawnPositions = TotalPositions; + } + + if (mapping.TryGetNode("head", out var headNode)) + { + IsHead = headNode.AsBool(); + } + + if (mapping.TryGetNode("access", out YamlSequenceNode accessNode)) + { + Access = accessNode.Select(i => i.ToString()).ToList(); + } + else + { + Access = Array.Empty(); + } } } } diff --git a/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml b/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml index e9e5f1fa8d..c2f6f89eb2 100644 --- a/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml +++ b/Resources/Prototypes/Jobs/Cargo/CargoTechnician.yml @@ -1,6 +1,8 @@ - type: job id: CargoTechnician name: "Cargo Technician" - startingGear: CargoTechnicianGear + positions: 2 + spawnPositions: 1 + startingGear: AssistantGear department: - Cargo diff --git a/Resources/Prototypes/Jobs/Civilian/Assistant.yml b/Resources/Prototypes/Jobs/Civilian/Assistant.yml index bcdffe2a6b..6bee749932 100644 --- a/Resources/Prototypes/Jobs/Civilian/Assistant.yml +++ b/Resources/Prototypes/Jobs/Civilian/Assistant.yml @@ -1,10 +1,14 @@ - type: job id: Assistant name: "Assistant" + positions: -1 # Treated as infinite. startingGear: AssistantGear department: - Civilian + access: + - maintenance + - type: startingGear id: AssistantGear equipment: diff --git a/Resources/Prototypes/Jobs/Civilian/Clown.yml b/Resources/Prototypes/Jobs/Civilian/Clown.yml index 63f52c65ec..f906e04a2b 100644 --- a/Resources/Prototypes/Jobs/Civilian/Clown.yml +++ b/Resources/Prototypes/Jobs/Civilian/Clown.yml @@ -1,6 +1,15 @@ - type: job id: Clown name: "Clown" + positions: 1 startingGear: ClownGear department: - Civilian + +- type: startingGear + id: ClownGear + equipment: + innerclothing: UniformClown + backpack: ClownPack + shoes: ShoesClown + mask: MaskClown diff --git a/Resources/Prototypes/Jobs/Civilian/Janitor.yml b/Resources/Prototypes/Jobs/Civilian/Janitor.yml index c54940e210..fa250129b4 100644 --- a/Resources/Prototypes/Jobs/Civilian/Janitor.yml +++ b/Resources/Prototypes/Jobs/Civilian/Janitor.yml @@ -1,6 +1,11 @@ - type: job id: Janitor name: "Janitor" - startingGear: JanitorGear + positions: 1 + startingGear: AssistantGear department: - Civilian + + access: + - service + - maintenance diff --git a/Resources/Prototypes/Jobs/Command/Captain.yml b/Resources/Prototypes/Jobs/Command/Captain.yml index 5da9d7ca2a..69ae06e732 100644 --- a/Resources/Prototypes/Jobs/Command/Captain.yml +++ b/Resources/Prototypes/Jobs/Command/Captain.yml @@ -1,6 +1,22 @@ - type: job id: Captain name: "Captain" - startingGear: CaptainGear + head: true + positions: 1 + startingGear: AssistantGear department: - Command + + access: + # All of em. + # Could probably do with some kind of wildcard or whatever to automate this. + - captain + - idCard + - command + - security + - engineering + - medical + - cargo + - research + - service + - maintenance diff --git a/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml b/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml index d7cb09f750..2ab5a18629 100644 --- a/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml +++ b/Resources/Prototypes/Jobs/Command/HeadOfPersonnel.yml @@ -1,7 +1,18 @@ - type: job id: HeadOfPersonnel name: "Head Of Personnel" - startingGear: HeadOfPersonnelGear + head: true + positions: 1 + startingGear: AssistantGear department: - Command - Civilian + + access: + - command + - idCard + - security # HoPcurity strikes again + - service + - cargo + - maintenance + # I mean they'll give themselves the rest of the access levels *anyways*. diff --git a/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml b/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml index 2f1f0e945e..640b78e980 100644 --- a/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml +++ b/Resources/Prototypes/Jobs/Engineering/ChiefEngineer.yml @@ -1,7 +1,14 @@ - type: job id: ChiefEngineer name: "Chief Engineer" - startingGear: ChiefEngineerGear + head: true + positions: 1 + startingGear: StationEngineerGear department: - Command - Engineering + + access: + - maintenance + - engineering + - command diff --git a/Resources/Prototypes/Jobs/Engineering/Engineer.yml b/Resources/Prototypes/Jobs/Engineering/Engineer.yml index 874fa683b7..48c0c5ee09 100644 --- a/Resources/Prototypes/Jobs/Engineering/Engineer.yml +++ b/Resources/Prototypes/Jobs/Engineering/Engineer.yml @@ -1,10 +1,16 @@ - type: job id: StationEngineer name: "Station Engineer" + positions: 3 + spawnPositions: 2 startingGear: StationEngineerGear department: - Engineering + access: + - maintenance + - engineering + - type: startingGear id: StationEngineerGear equipment: diff --git a/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml b/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml index 8e0f61f812..5a484cce51 100644 --- a/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml +++ b/Resources/Prototypes/Jobs/Medical/ChiefMedicalOfficer.yml @@ -3,7 +3,13 @@ - type: job id: ChiefMedicalOfficer name: "Chief Medical Officer" - startingGear: ChiefMedicalOfficerGear + head: true + positions: 1 + startingGear: AssistantGear department: - Command - Medical + + access: + - medical + - command diff --git a/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml b/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml index dab245a979..db4490a973 100644 --- a/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml +++ b/Resources/Prototypes/Jobs/Medical/MedicalDoctor.yml @@ -1,6 +1,11 @@ - type: job id: MedicalDoctor name: "Medical Doctor" - startingGear: MedicalDoctorGear + positions: 3 + spawnPositions: 2 + startingGear: AssistantGear department: - Medical + + access: + - medical diff --git a/Resources/Prototypes/Jobs/Science/ResearchDirector.yml b/Resources/Prototypes/Jobs/Science/ResearchDirector.yml index ec56beef4c..e399a9023e 100644 --- a/Resources/Prototypes/Jobs/Science/ResearchDirector.yml +++ b/Resources/Prototypes/Jobs/Science/ResearchDirector.yml @@ -1,7 +1,13 @@ - type: job id: ResearchDirector name: "Research Director" - startingGear: ResearchDirectorGear + head: true + positions: 1 + startingGear: AssistantGear department: - Command - Science + + access: + - research + - command diff --git a/Resources/Prototypes/Jobs/Science/Scientist.yml b/Resources/Prototypes/Jobs/Science/Scientist.yml index d53cbc50a9..88ce927148 100644 --- a/Resources/Prototypes/Jobs/Science/Scientist.yml +++ b/Resources/Prototypes/Jobs/Science/Scientist.yml @@ -1,6 +1,11 @@ - type: job id: Scientist name: "Scientist" - startingGear: ScientistGear + positions: 3 + spawnPositions: 2 + startingGear: AssistantGear department: - Science + + access: + - research diff --git a/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml b/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml index 5b59be106a..c051afdd39 100644 --- a/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml +++ b/Resources/Prototypes/Jobs/Security/HeadOfSecurity.yml @@ -1,7 +1,14 @@ - type: job id: HeadOfSecurity name: "Head Of Security" - startingGear: HeadOfSecurityGear + head: true + positions: 1 + startingGear: AssistantGear department: - Command - Security + + access: + - command + - security + - maintenance diff --git a/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml b/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml index 8567bc8524..5e8043dcfd 100644 --- a/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml +++ b/Resources/Prototypes/Jobs/Security/SecurityOfficer.yml @@ -1,6 +1,12 @@ - type: job id: SecurityOfficer name: "Security Officer" - startingGear: SecurityOfficerGear + positions: 3 + spawnPositions: 2 + startingGear: AssistantGear department: - Security + + access: + - security + - maintenance