Add warnings when TagSystem methods are called with string literals (#36281)

Apply ForbidLiteralAttribute to all appropriate TagSystem methods
This commit is contained in:
Tayrtahn
2025-04-12 10:18:31 -04:00
committed by GitHub
parent a6a29e2554
commit 76e72893c9

View File

@@ -50,7 +50,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool AddTag(EntityUid entityUid, ProtoId<TagPrototype> tag) public bool AddTag(EntityUid entityUid, [ForbidLiteral] ProtoId<TagPrototype> tag)
{ {
return AddTag((entityUid, EnsureComp<TagComponent>(entityUid)), tag); return AddTag((entityUid, EnsureComp<TagComponent>(entityUid)), tag);
} }
@@ -64,9 +64,9 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool AddTags(EntityUid entityUid, params ProtoId<TagPrototype>[] tags) public bool AddTags(EntityUid entityUid, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
return AddTags(entityUid, (IEnumerable<ProtoId<TagPrototype>>)tags); return AddTags(entityUid, (IEnumerable<ProtoId<TagPrototype>>)tags);
} }
/// <summary> /// <summary>
@@ -78,7 +78,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool AddTags(EntityUid entityUid, IEnumerable<ProtoId<TagPrototype>> tags) public bool AddTags(EntityUid entityUid, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
return AddTags((entityUid, EnsureComp<TagComponent>(entityUid)), tags); return AddTags((entityUid, EnsureComp<TagComponent>(entityUid)), tags);
} }
@@ -93,7 +93,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool TryAddTag(EntityUid entityUid, ProtoId<TagPrototype> tag) public bool TryAddTag(EntityUid entityUid, [ForbidLiteral] ProtoId<TagPrototype> tag)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
AddTag((entityUid, component), tag); AddTag((entityUid, component), tag);
@@ -109,7 +109,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool TryAddTags(EntityUid entityUid, params ProtoId<TagPrototype>[] tags) public bool TryAddTags(EntityUid entityUid, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
return TryAddTags(entityUid, (IEnumerable<ProtoId<TagPrototype>>)tags); return TryAddTags(entityUid, (IEnumerable<ProtoId<TagPrototype>>)tags);
} }
@@ -124,7 +124,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool TryAddTags(EntityUid entityUid, IEnumerable<ProtoId<TagPrototype>> tags) public bool TryAddTags(EntityUid entityUid, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
AddTags((entityUid, component), tags); AddTags((entityUid, component), tags);
@@ -139,7 +139,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool HasTag(EntityUid entityUid, ProtoId<TagPrototype> tag) public bool HasTag(EntityUid entityUid, [ForbidLiteral] ProtoId<TagPrototype> tag)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasTag(component, tag); HasTag(component, tag);
@@ -166,7 +166,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(EntityUid entityUid, params ProtoId<TagPrototype>[] tags) public bool HasAllTags(EntityUid entityUid, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAllTags(component, tags); HasAllTags(component, tags);
@@ -181,7 +181,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(EntityUid entityUid, HashSet<ProtoId<TagPrototype>> tags) public bool HasAllTags(EntityUid entityUid, [ForbidLiteral] HashSet<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAllTags(component, tags); HasAllTags(component, tags);
@@ -196,7 +196,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(EntityUid entityUid, List<ProtoId<TagPrototype>> tags) public bool HasAllTags(EntityUid entityUid, [ForbidLiteral] List<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAllTags(component, tags); HasAllTags(component, tags);
@@ -211,7 +211,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(EntityUid entityUid, IEnumerable<ProtoId<TagPrototype>> tags) public bool HasAllTags(EntityUid entityUid, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAllTags(component, tags); HasAllTags(component, tags);
@@ -226,7 +226,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool HasAnyTag(EntityUid entityUid, ProtoId<TagPrototype> tag) => public bool HasAnyTag(EntityUid entityUid, [ForbidLiteral] ProtoId<TagPrototype> tag) =>
HasTag(entityUid, tag); HasTag(entityUid, tag);
/// <summary> /// <summary>
@@ -238,7 +238,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(EntityUid entityUid, params ProtoId<TagPrototype>[] tags) public bool HasAnyTag(EntityUid entityUid, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAnyTag(component, tags); HasAnyTag(component, tags);
@@ -253,7 +253,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(EntityUid entityUid, HashSet<ProtoId<TagPrototype>> tags) public bool HasAnyTag(EntityUid entityUid, [ForbidLiteral] HashSet<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAnyTag(component, tags); HasAnyTag(component, tags);
@@ -268,7 +268,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(EntityUid entityUid, List<ProtoId<TagPrototype>> tags) public bool HasAnyTag(EntityUid entityUid, [ForbidLiteral] List<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAnyTag(component, tags); HasAnyTag(component, tags);
@@ -283,7 +283,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(EntityUid entityUid, IEnumerable<ProtoId<TagPrototype>> tags) public bool HasAnyTag(EntityUid entityUid, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
HasAnyTag(component, tags); HasAnyTag(component, tags);
@@ -298,7 +298,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool HasTag(TagComponent component, ProtoId<TagPrototype> tag) public bool HasTag(TagComponent component, [ForbidLiteral] ProtoId<TagPrototype> tag)
{ {
#if DEBUG #if DEBUG
AssertValidTag(tag); AssertValidTag(tag);
@@ -315,7 +315,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool HasAllTags(TagComponent component, ProtoId<TagPrototype> tag) => public bool HasAllTags(TagComponent component, [ForbidLiteral] ProtoId<TagPrototype> tag) =>
HasTag(component, tag); HasTag(component, tag);
/// <summary> /// <summary>
@@ -327,7 +327,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(TagComponent component, params ProtoId<TagPrototype>[] tags) public bool HasAllTags(TagComponent component, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -350,7 +350,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTagsArray(TagComponent component, ProtoId<TagPrototype>[] tags) public bool HasAllTagsArray(TagComponent component, [ForbidLiteral] ProtoId<TagPrototype>[] tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -373,7 +373,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(TagComponent component, List<ProtoId<TagPrototype>> tags) public bool HasAllTags(TagComponent component, [ForbidLiteral] List<ProtoId<TagPrototype>> tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -396,7 +396,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(TagComponent component, HashSet<ProtoId<TagPrototype>> tags) public bool HasAllTags(TagComponent component, [ForbidLiteral] HashSet<ProtoId<TagPrototype>> tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -419,7 +419,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAllTags(TagComponent component, IEnumerable<ProtoId<TagPrototype>> tags) public bool HasAllTags(TagComponent component, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -442,7 +442,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool HasAnyTag(TagComponent component, ProtoId<TagPrototype> tag) => public bool HasAnyTag(TagComponent component, [ForbidLiteral] ProtoId<TagPrototype> tag) =>
HasTag(component, tag); HasTag(component, tag);
/// <summary> /// <summary>
@@ -454,7 +454,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(TagComponent component, params ProtoId<TagPrototype>[] tags) public bool HasAnyTag(TagComponent component, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -477,7 +477,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(TagComponent component, HashSet<ProtoId<TagPrototype>> tags) public bool HasAnyTag(TagComponent component, [ForbidLiteral] HashSet<ProtoId<TagPrototype>> tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -500,7 +500,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(TagComponent component, List<ProtoId<TagPrototype>> tags) public bool HasAnyTag(TagComponent component, [ForbidLiteral] List<ProtoId<TagPrototype>> tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -523,7 +523,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool HasAnyTag(TagComponent component, IEnumerable<ProtoId<TagPrototype>> tags) public bool HasAnyTag(TagComponent component, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
foreach (var tag in tags) foreach (var tag in tags)
{ {
@@ -546,7 +546,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool RemoveTag(EntityUid entityUid, ProtoId<TagPrototype> tag) public bool RemoveTag(EntityUid entityUid, [ForbidLiteral] ProtoId<TagPrototype> tag)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
RemoveTag((entityUid, component), tag); RemoveTag((entityUid, component), tag);
@@ -561,7 +561,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool RemoveTags(EntityUid entityUid, params ProtoId<TagPrototype>[] tags) public bool RemoveTags(EntityUid entityUid, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
return RemoveTags(entityUid, (IEnumerable<ProtoId<TagPrototype>>)tags); return RemoveTags(entityUid, (IEnumerable<ProtoId<TagPrototype>>)tags);
} }
@@ -575,7 +575,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool RemoveTags(EntityUid entityUid, IEnumerable<ProtoId<TagPrototype>> tags) public bool RemoveTags(EntityUid entityUid, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
return _tagQuery.TryComp(entityUid, out var component) && return _tagQuery.TryComp(entityUid, out var component) &&
RemoveTags((entityUid, component), tags); RemoveTags((entityUid, component), tags);
@@ -590,7 +590,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool AddTag(Entity<TagComponent> entity, ProtoId<TagPrototype> tag) public bool AddTag(Entity<TagComponent> entity, [ForbidLiteral] ProtoId<TagPrototype> tag)
{ {
#if DEBUG #if DEBUG
AssertValidTag(tag); AssertValidTag(tag);
@@ -611,7 +611,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool AddTags(Entity<TagComponent> entity, params ProtoId<TagPrototype>[] tags) public bool AddTags(Entity<TagComponent> entity, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
return AddTags(entity, (IEnumerable<ProtoId<TagPrototype>>)tags); return AddTags(entity, (IEnumerable<ProtoId<TagPrototype>>)tags);
} }
@@ -625,7 +625,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool AddTags(Entity<TagComponent> entity, IEnumerable<ProtoId<TagPrototype>> tags) public bool AddTags(Entity<TagComponent> entity, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
var update = false; var update = false;
foreach (var tag in tags) foreach (var tag in tags)
@@ -653,7 +653,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception> /// </exception>
public bool RemoveTag(Entity<TagComponent> entity, ProtoId<TagPrototype> tag) public bool RemoveTag(Entity<TagComponent> entity, [ForbidLiteral] ProtoId<TagPrototype> tag)
{ {
#if DEBUG #if DEBUG
AssertValidTag(tag); AssertValidTag(tag);
@@ -675,7 +675,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool RemoveTags(Entity<TagComponent> entity, params ProtoId<TagPrototype>[] tags) public bool RemoveTags(Entity<TagComponent> entity, [ForbidLiteral] params ProtoId<TagPrototype>[] tags)
{ {
return RemoveTags(entity, (IEnumerable<ProtoId<TagPrototype>>)tags); return RemoveTags(entity, (IEnumerable<ProtoId<TagPrototype>>)tags);
} }
@@ -689,7 +689,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException"> /// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception> /// </exception>
public bool RemoveTags(Entity<TagComponent> entity, IEnumerable<ProtoId<TagPrototype>> tags) public bool RemoveTags(Entity<TagComponent> entity, [ForbidLiteral] IEnumerable<ProtoId<TagPrototype>> tags)
{ {
var update = false; var update = false;
foreach (var tag in tags) foreach (var tag in tags)