Make clown clumsy. (#1481)
Co-authored-by: scuffedjays <yetanotherscuffed@gmail.com>
This commit is contained in:
committed by
GitHub
parent
fbbe43fff8
commit
2bd318e83f
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Jobs;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Serialization;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Shared.Jobs
|
||||
@@ -41,44 +41,25 @@ namespace Content.Shared.Jobs
|
||||
|
||||
public string Icon { get; private set; }
|
||||
|
||||
public JobSpecial Special { 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 = Loc.GetString(mapping.GetNode("name").ToString());
|
||||
StartingGear = mapping.GetNode("startingGear").ToString();
|
||||
Department = mapping.GetNode("department").AllNodes.Select(i => i.ToString()).ToList();
|
||||
TotalPositions = mapping.GetNode("positions").AsInt();
|
||||
var srz = YamlObjectSerializer.NewReader(mapping);
|
||||
ID = srz.ReadDataField<string>("id");
|
||||
Name = Loc.GetString(srz.ReadDataField<string>("name"));
|
||||
StartingGear = srz.ReadDataField<string>("startingGear");
|
||||
Department = srz.ReadDataField<List<string>>("department");
|
||||
TotalPositions = srz.ReadDataField<int>("positions");
|
||||
|
||||
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>();
|
||||
}
|
||||
|
||||
if (mapping.TryGetNode("icon", out var iconNode))
|
||||
{
|
||||
Icon = iconNode.AsString();
|
||||
}
|
||||
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<string>());
|
||||
srz.DataField(this, p => p.Icon, "icon", null);
|
||||
srz.DataField(this, p => p.Special, "special", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user