From ac9d236955b7f76e224bbe7df8b7e0a45da0b025 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 19 Jan 2020 18:33:30 +0100 Subject: [PATCH] Acc --- Content.Shared/Access/AccessLevelPrototype.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Content.Shared/Access/AccessLevelPrototype.cs diff --git a/Content.Shared/Access/AccessLevelPrototype.cs b/Content.Shared/Access/AccessLevelPrototype.cs new file mode 100644 index 0000000000..9e042701ae --- /dev/null +++ b/Content.Shared/Access/AccessLevelPrototype.cs @@ -0,0 +1,36 @@ +using Robust.Shared.Localization; +using Robust.Shared.Prototypes; +using Robust.Shared.Utility; +using YamlDotNet.RepresentationModel; + +namespace Content.Shared.Access +{ + /// + /// Defines a single access level that can be stored on ID cards and checked for. + /// + [Prototype("accessLevel")] + public class AccessLevelPrototype : IPrototype, IIndexedPrototype + { + public void LoadFrom(YamlMappingNode mapping) + { + ID = mapping.GetNode("id").AsString(); + if (mapping.TryGetNode("name", out var nameNode)) + { + Name = nameNode.AsString(); + } + else + { + Name = ID; + } + + Name = Loc.GetString(Name); + } + + public string ID { get; private set; } + + /// + /// The player-visible name of the access level, in the ID card console and such. + /// + public string Name { get; private set; } + } +}