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.Collections.Generic;
using System.Linq;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.Jobs
{
/// <summary>
/// Describes information for a single job on the station.
/// </summary>
[Prototype("job")]
public class JobPrototype : IPrototype, IIndexedPrototype
{
public string ID { get; private set; }
/// <summary>
/// The name of this job as displayed to players.
/// </summary>
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 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)
{
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<string>();
}
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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*.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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