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:
@@ -5,6 +5,7 @@ using Content.Shared.Construction;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Construction.Commands;
|
||||
|
||||
@@ -13,6 +14,10 @@ public sealed class FixRotationsCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
|
||||
private static readonly ProtoId<TagPrototype> ForceFixRotationsTag = "ForceFixRotations";
|
||||
private static readonly ProtoId<TagPrototype> ForceNoFixRotationsTag = "ForceNoFixRotations";
|
||||
private static readonly ProtoId<TagPrototype> DiagonalTag = "Diagonal";
|
||||
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
public string Command => "fixrotations";
|
||||
public string Description => "Sets the rotation of all occluders, low walls and windows to south.";
|
||||
@@ -86,11 +91,11 @@ public sealed class FixRotationsCommand : IConsoleCommand
|
||||
// cables
|
||||
valid |= _entManager.HasComponent<CableComponent>(child);
|
||||
// anything else that might need this forced
|
||||
valid |= tagSystem.HasTag(child, "ForceFixRotations");
|
||||
valid |= tagSystem.HasTag(child, ForceFixRotationsTag);
|
||||
// override
|
||||
valid &= !tagSystem.HasTag(child, "ForceNoFixRotations");
|
||||
valid &= !tagSystem.HasTag(child, ForceNoFixRotationsTag);
|
||||
// remove diagonal entities as well
|
||||
valid &= !tagSystem.HasTag(child, "Diagonal");
|
||||
valid &= !tagSystem.HasTag(child, DiagonalTag);
|
||||
|
||||
if (!valid)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user