mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-03 02:27:08 +02:00
retires DataFieldWithConstantAttribute & DataFieldWithFlagAttribute in favor of new customtypeserializers adds prototypeidvalidation, just needs to be added to the corresponding fields fixes some behaviour in yamllinter
36 lines
1.2 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|