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
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user