Files
RobustToolbox/Robust.Shared/Serialization/Manager/Attributes/DataFieldAttribute.cs
T
Paul RitterandGitHub 7d2fb85a04 adds custom typeserializers (#1636)
retires DataFieldWithConstantAttribute & DataFieldWithFlagAttribute in favor of new customtypeserializers
adds prototypeidvalidation, just needs to be added to the corresponding fields
fixes some behaviour in yamllinter
2021-03-15 13:24:29 +01:00

36 lines
1.2 KiB
C#

using System;
using JetBrains.Annotations;
namespace Robust.Shared.Serialization.Manager.Attributes
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
[MeansImplicitAssignment]
public class DataFieldAttribute : Attribute
{
public readonly string Tag;
public readonly int Priority;
public readonly bool ReadOnly;
/// <summary>
/// Whether or not this field being mapped is required for the component to function.
/// This will not guarantee that the field is mapped when the program is run,
/// it is meant to be used as metadata information.
/// </summary>
public readonly bool Required;
public readonly bool ServerOnly;
public readonly Type? CustomTypeSerializer;
public DataFieldAttribute([NotNull] string tag, bool readOnly = false, int priority = 1, bool required = false, bool serverOnly = false, Type? customTypeSerializer = null)
{
Tag = tag;
Priority = priority;
ReadOnly = readOnly;
Required = required;
ServerOnly = serverOnly;
CustomTypeSerializer = customTypeSerializer;
}
}
}