Extracts magic strings from Tag calls (#36305)

* Extracts magic strings from Tag calls

When #36281 gets merged, the `TagSystem` methods will all give warnings. Let's fix those warnings before they even happen!

* Adds missing libraries

* Remove not yet implemented TagSystem changes

* Fix tag spelling error

Genuinely surprised there was only 1!

* Styling and proper type changes

* Styling

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>

---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
This commit is contained in:
J
2025-04-05 00:20:19 +00:00
committed by GitHub
parent e58ab56e42
commit af9526197a
36 changed files with 156 additions and 51 deletions

View File

@@ -11,6 +11,7 @@ using Robust.Shared.Serialization.Manager;
using Robust.Shared.Utility;
using System.Linq;
using Robust.Server.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.Server.Payload.EntitySystems;
@@ -23,6 +24,8 @@ public sealed class PayloadSystem : EntitySystem
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!;
private static readonly ProtoId<TagPrototype> PayloadTag = "Payload";
public override void Initialize()
{
base.Initialize();
@@ -44,7 +47,7 @@ public sealed class PayloadSystem : EntitySystem
{
foreach (var entity in container.ContainedEntities)
{
if (_tagSystem.HasTag(entity, "Payload"))
if (_tagSystem.HasTag(entity, PayloadTag))
yield return entity;
}
}
@@ -71,7 +74,7 @@ public sealed class PayloadSystem : EntitySystem
return;
// Ensure we don't enter a trigger-loop
DebugTools.Assert(!_tagSystem.HasTag(uid, "Payload"));
DebugTools.Assert(!_tagSystem.HasTag(uid, PayloadTag));
RaiseLocalEvent(parent, args, false);
}