Adds more metadata to job prototypes:

Whether the job is a head.
The access levels the job has.
The total & spawn positions count.
This commit is contained in:
Pieter-Jan Briers
2020-01-19 18:31:14 +01:00
parent ce794c4dac
commit 02fbc5938b
15 changed files with 159 additions and 14 deletions

View File

@@ -1,27 +1,77 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel; using YamlDotNet.RepresentationModel;
namespace Content.Shared.Jobs namespace Content.Shared.Jobs
{ {
/// <summary>
/// Describes information for a single job on the station.
/// </summary>
[Prototype("job")] [Prototype("job")]
public class JobPrototype : IPrototype, IIndexedPrototype public class JobPrototype : IPrototype, IIndexedPrototype
{ {
public string ID { get; private set; } public string ID { get; private set; }
/// <summary>
/// The name of this job as displayed to players.
/// </summary>
public string Name { get; private set; } public string Name { get; private set; }
/// <summary>
/// Whether this job is a head.
/// The job system will try to pick heads before other jobs on the same priority level.
/// </summary>
public bool IsHead { get; private set; }
/// <summary>
/// The total amount of people that can start with this job round-start.
/// </summary>
public int SpawnPositions { get; private set; }
/// <summary>
/// The total amount of positions available.
/// </summary>
public int TotalPositions { get; private set; }
public string StartingGear { get; private set; } public string StartingGear { get; private set; }
public IEnumerable<string> Department { get; private set; }
public IReadOnlyCollection<string> Department { get; private set; }
public IReadOnlyCollection<string> Access { get; private set; }
public void LoadFrom(YamlMappingNode mapping) public void LoadFrom(YamlMappingNode mapping)
{ {
ID = mapping.GetNode("id").AsString(); ID = mapping.GetNode("id").AsString();
Name = mapping.GetNode("name").ToString(); Name = Loc.GetString(mapping.GetNode("name").ToString());
StartingGear = mapping.GetNode("startingGear").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<string>();
}
} }
} }
} }

View File

@@ -1,6 +1,8 @@
- type: job - type: job
id: CargoTechnician id: CargoTechnician
name: "Cargo Technician" name: "Cargo Technician"
startingGear: CargoTechnicianGear positions: 2
spawnPositions: 1
startingGear: AssistantGear
department: department:
- Cargo - Cargo

View File

@@ -1,10 +1,14 @@
- type: job - type: job
id: Assistant id: Assistant
name: "Assistant" name: "Assistant"
positions: -1 # Treated as infinite.
startingGear: AssistantGear startingGear: AssistantGear
department: department:
- Civilian - Civilian
access:
- maintenance
- type: startingGear - type: startingGear
id: AssistantGear id: AssistantGear
equipment: equipment:

View File

@@ -1,6 +1,15 @@
- type: job - type: job
id: Clown id: Clown
name: "Clown" name: "Clown"
positions: 1
startingGear: ClownGear startingGear: ClownGear
department: department:
- Civilian - Civilian
- type: startingGear
id: ClownGear
equipment:
innerclothing: UniformClown
backpack: ClownPack
shoes: ShoesClown
mask: MaskClown

View File

@@ -1,6 +1,11 @@
- type: job - type: job
id: Janitor id: Janitor
name: "Janitor" name: "Janitor"
startingGear: JanitorGear positions: 1
startingGear: AssistantGear
department: department:
- Civilian - Civilian
access:
- service
- maintenance

View File

@@ -1,6 +1,22 @@
- type: job - type: job
id: Captain id: Captain
name: "Captain" name: "Captain"
startingGear: CaptainGear head: true
positions: 1
startingGear: AssistantGear
department: department:
- Command - 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

View File

@@ -1,7 +1,18 @@
- type: job - type: job
id: HeadOfPersonnel id: HeadOfPersonnel
name: "Head Of Personnel" name: "Head Of Personnel"
startingGear: HeadOfPersonnelGear head: true
positions: 1
startingGear: AssistantGear
department: department:
- Command - Command
- Civilian - Civilian
access:
- command
- idCard
- security # HoPcurity strikes again
- service
- cargo
- maintenance
# I mean they'll give themselves the rest of the access levels *anyways*.

View File

@@ -1,7 +1,14 @@
- type: job - type: job
id: ChiefEngineer id: ChiefEngineer
name: "Chief Engineer" name: "Chief Engineer"
startingGear: ChiefEngineerGear head: true
positions: 1
startingGear: StationEngineerGear
department: department:
- Command - Command
- Engineering - Engineering
access:
- maintenance
- engineering
- command

View File

@@ -1,10 +1,16 @@
- type: job - type: job
id: StationEngineer id: StationEngineer
name: "Station Engineer" name: "Station Engineer"
positions: 3
spawnPositions: 2
startingGear: StationEngineerGear startingGear: StationEngineerGear
department: department:
- Engineering - Engineering
access:
- maintenance
- engineering
- type: startingGear - type: startingGear
id: StationEngineerGear id: StationEngineerGear
equipment: equipment:

View File

@@ -3,7 +3,13 @@
- type: job - type: job
id: ChiefMedicalOfficer id: ChiefMedicalOfficer
name: "Chief Medical Officer" name: "Chief Medical Officer"
startingGear: ChiefMedicalOfficerGear head: true
positions: 1
startingGear: AssistantGear
department: department:
- Command - Command
- Medical - Medical
access:
- medical
- command

View File

@@ -1,6 +1,11 @@
- type: job - type: job
id: MedicalDoctor id: MedicalDoctor
name: "Medical Doctor" name: "Medical Doctor"
startingGear: MedicalDoctorGear positions: 3
spawnPositions: 2
startingGear: AssistantGear
department: department:
- Medical - Medical
access:
- medical

View File

@@ -1,7 +1,13 @@
- type: job - type: job
id: ResearchDirector id: ResearchDirector
name: "Research Director" name: "Research Director"
startingGear: ResearchDirectorGear head: true
positions: 1
startingGear: AssistantGear
department: department:
- Command - Command
- Science - Science
access:
- research
- command

View File

@@ -1,6 +1,11 @@
- type: job - type: job
id: Scientist id: Scientist
name: "Scientist" name: "Scientist"
startingGear: ScientistGear positions: 3
spawnPositions: 2
startingGear: AssistantGear
department: department:
- Science - Science
access:
- research

View File

@@ -1,7 +1,14 @@
- type: job - type: job
id: HeadOfSecurity id: HeadOfSecurity
name: "Head Of Security" name: "Head Of Security"
startingGear: HeadOfSecurityGear head: true
positions: 1
startingGear: AssistantGear
department: department:
- Command - Command
- Security - Security
access:
- command
- security
- maintenance

View File

@@ -1,6 +1,12 @@
- type: job - type: job
id: SecurityOfficer id: SecurityOfficer
name: "Security Officer" name: "Security Officer"
startingGear: SecurityOfficerGear positions: 3
spawnPositions: 2
startingGear: AssistantGear
department: department:
- Security - Security
access:
- security
- maintenance