Files
OldThink/Content.Server/GameTicking/GamePresets/GamePresetAttribute.cs
DrSmugleaf a8e9bf0488 Add game preset attribute, unhardcode game presets (#3166)
* Add game preset attribute, unhardcode game presets

* Add game preset attribute doc

* Add preset attribute to extended

* Remove try methods from playerdata
2021-02-14 15:39:24 +01:00

28 lines
812 B
C#

using System;
using System.Collections.Immutable;
using JetBrains.Annotations;
namespace Content.Server.GameTicking.GamePresets
{
/// <summary>
/// Attribute that marks a game preset.
/// The id and aliases are registered in lowercase in <see cref="GameTicker"/>.
/// A duplicate id or alias will throw an exception.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
[BaseTypeRequired(typeof(GamePreset))]
[MeansImplicitUse]
public class GamePresetAttribute : Attribute
{
public string Id { get; }
public ImmutableList<string> Aliases { get; }
public GamePresetAttribute(string id, params string[] aliases)
{
Id = id;
Aliases = aliases.ToImmutableList();
}
}
}