Obsolete comp references (#3900)

This commit is contained in:
metalgearsloth
2023-04-29 03:54:24 +10:00
committed by GitHub
parent 365fad488c
commit 7cdd45b4ff

View File

@@ -1,26 +1,30 @@
using System;
namespace Robust.Shared.GameObjects
namespace Robust.Shared.GameObjects;
/*
* Obsoleted because this has a massive performance cost and it is not worth it.
*/
/// <summary>
/// Marks a component as having a specific reference type,
/// for use with <see cref="RegisterComponentAttribute"/>.
/// </summary>
[Obsolete("Refactor your code to not use component references.")]
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
public sealed class ComponentReferenceAttribute : Attribute
{
/// <summary>
/// Marks a component as having a specific reference type,
/// for use with <see cref="RegisterComponentAttribute"/>.
/// The type this component is a reference to.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
public sealed class ComponentReferenceAttribute : Attribute
{
/// <summary>
/// The type this component is a reference to.
/// </summary>
public Type ReferenceType { get; }
public Type ReferenceType { get; }
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="referenceType">The type this component is a reference to.</param>
public ComponentReferenceAttribute(Type referenceType)
{
ReferenceType = referenceType;
}
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="referenceType">The type this component is a reference to.</param>
public ComponentReferenceAttribute(Type referenceType)
{
ReferenceType = referenceType;
}
}