using System;
using System.Collections.Generic;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.Roles
{
///
/// 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 string Icon { get; private set; }
public JobSpecial Special { get; private set; }
public IReadOnlyCollection Department { get; private set; }
public IReadOnlyCollection Access { get; private set; }
public void LoadFrom(YamlMappingNode mapping)
{
var srz = YamlObjectSerializer.NewReader(mapping);
ID = srz.ReadDataField("id");
Name = Loc.GetString(srz.ReadDataField("name"));
StartingGear = srz.ReadDataField("startingGear");
Department = srz.ReadDataField>("department");
TotalPositions = srz.ReadDataField("positions");
srz.DataField(this, p => p.SpawnPositions, "spawnPositions", TotalPositions);
srz.DataField(this, p => p.IsHead, "head", false);
srz.DataField(this, p => p.Access, "access", Array.Empty());
srz.DataField(this, p => p.Icon, "icon", null);
srz.DataField(this, p => p.Special, "special", null);
}
}
}