Lint more const string prototypes (#18922)

This commit is contained in:
Vordenburg
2023-08-13 20:26:59 -04:00
committed by GitHub
parent 17808a54ef
commit 7582474f1a
32 changed files with 73 additions and 19 deletions

View File

@@ -20,7 +20,6 @@ using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Linq;
using System.Numerics;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
@@ -57,7 +56,10 @@ public sealed class DragDropSystem : SharedDragDropSystem
// mousedown event so it can be treated like a regular click
private const float MaxMouseDownTimeForReplayingClick = 0.85f;
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderDropTargetInRange = "SelectionOutlineInrange";
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderDropTargetOutOfRange = "SelectionOutline";
/// <summary>

View File

@@ -1,7 +1,5 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Client.Interactable.Components
@@ -13,8 +11,13 @@ namespace Content.Client.Interactable.Components
[Dependency] private readonly IEntityManager _entMan = default!;
private const float DefaultWidth = 1;
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderInRange = "SelectionOutlineInrange";
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderOutOfRange = "SelectionOutline";
private bool _inRange;
private ShaderInstance? _shader;
private int _lastRenderScale;

View File

@@ -63,8 +63,12 @@ public sealed class TargetOutlineSystem : EntitySystem
private Vector2 LookupVector => new(LookupSize, LookupSize);
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderTargetValid = "SelectionOutlineInrange";
[ValidatePrototypeId<ShaderPrototype>]
private const string ShaderTargetInvalid = "SelectionOutline";
private ShaderInstance? _shaderTargetValid;
private ShaderInstance? _shaderTargetInvalid;

View File

@@ -14,7 +14,9 @@ public sealed class ParallaxSystem : SharedParallaxSystem
[Dependency] private readonly IParallaxManager _parallax = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[ValidatePrototypeId<ParallaxPrototype>]
private const string Fallback = "Default";
public const int ParallaxZIndex = 0;
public override void Initialize()

View File

@@ -14,6 +14,7 @@ namespace Content.Server.Body.Commands
[AdminCommand(AdminFlags.Fun)]
sealed class AddHandCommand : IConsoleCommand
{
[ValidatePrototypeId<EntityPrototype>]
public const string DefaultHandPrototype = "LeftHandHuman";
public string Command => "addhand";

View File

@@ -1,9 +1,10 @@
using Content.Server.CrewManifest;
using Content.Server.CrewManifest;
using Content.Server.Station.Systems;
using Content.Shared.CartridgeLoader;
using Content.Shared.CartridgeLoader.Cartridges;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
namespace Content.Server.CartridgeLoader.Cartridges;
@@ -14,6 +15,7 @@ public sealed class CrewManifestCartridgeSystem : EntitySystem
[Dependency] private readonly CrewManifestSystem _crewManifest = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[ValidatePrototypeId<EntityPrototype>]
private const string CartridgePrototypeName = "CrewManifestCartridge";
/// <summary>

View File

@@ -15,6 +15,7 @@ using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
namespace Content.Server.Chemistry.EntitySystems
{
@@ -36,6 +37,7 @@ namespace Content.Server.Chemistry.EntitySystems
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
[ValidatePrototypeId<EntityPrototype>]
private const string PillPrototypeId = "Pill";
public override void Initialize()

View File

@@ -16,7 +16,10 @@ namespace Content.Server.Construction.Commands
public string Description => "Puts an underplating tile below every wall on a grid.";
public string Help => $"Usage: {Command} <gridId> | {Command}";
[ValidatePrototypeId<ContentTileDefinition>]
public const string TilePrototypeId = "Plating";
[ValidatePrototypeId<TagPrototype>]
public const string WallTag = "Wall";
public void Execute(IConsoleShell shell, string argStr, string[] args)

View File

@@ -12,6 +12,7 @@ namespace Content.Server.Electrocution
public string Description => Loc.GetString("electrocute-command-description");
public string Help => $"{Command} <uid> <seconds> <damage>";
[ValidatePrototypeId<StatusEffectPrototype>]
public const string ElectrocutionStatusEffect = "Electrocution";
public void Execute(IConsoleShell shell, string argStr, string[] args)

View File

@@ -52,7 +52,10 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
[Dependency] private readonly SharedStutteringSystem _stuttering = default!;
[Dependency] private readonly TagSystem _tag = default!;
[ValidatePrototypeId<StatusEffectPrototype>]
private const string StatusEffectKey = "Electrocution";
[ValidatePrototypeId<DamageTypePrototype>]
private const string DamageType = "Shock";
// Yes, this is absurdly small for a reason.

View File

@@ -61,6 +61,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// find errors. However some components, like rogue arrows, or some commands like the admin-smite need to have
/// a "default" option specified outside of yaml data-fields. Hence this const string.
/// </remarks>
[ValidatePrototypeId<ExplosionPrototype>]
public const string DefaultExplosionPrototypeId = "Default";
public override void Initialize()

View File

@@ -1,5 +1,6 @@
using Content.Server.Fluids.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Fluids.Components;
@@ -9,6 +10,7 @@ public sealed partial class PuddleSystem
{
private static readonly TimeSpan EvaporationCooldown = TimeSpan.FromSeconds(1);
[ValidatePrototypeId<ReagentPrototype>]
public const string EvaporationReagent = "Water";
private void OnEvaporationMapInit(EntityUid uid, EvaporationComponent component, MapInitEvent args)

View File

@@ -6,6 +6,7 @@ namespace Content.Server.GameTicking
{
public sealed partial class GameTicker
{
[ValidatePrototypeId<SoundCollectionPrototype>]
private const string LobbyMusicCollection = "LobbyMusic";
[ViewVariables]

View File

@@ -9,13 +9,13 @@ using Content.Server.Speech.Components;
using Content.Server.Station.Components;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Job = Content.Server.Roles.Job;
@@ -26,6 +26,7 @@ namespace Content.Server.GameTicking
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[ValidatePrototypeId<EntityPrototype>]
private const string ObserverPrototypeName = "MobObserver";
/// <summary>

View File

@@ -1,17 +1,15 @@
using System.Threading;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
using Content.Server.UserInterface;
using Content.Shared.Access;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Popups;
using Content.Shared.Shuttles.BUIStates;
using Content.Shared.Shuttles.Events;
using Content.Shared.Shuttles.Systems;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Timer = Robust.Shared.Timing.Timer;
@@ -63,6 +61,7 @@ public sealed partial class EmergencyShuttleSystem
private CancellationTokenSource? _roundEndCancelToken;
[ValidatePrototypeId<AccessLevelPrototype>]
private const string EmergencyRepealAllAccess = "EmergencyShuttleRepealAll";
private static readonly Color DangerColor = Color.Red;

View File

@@ -16,6 +16,7 @@ using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.Shuttles.Components;
using Content.Shared.Shuttles.Events;
using Content.Shared.Tag;
using Content.Shared.Tiles;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
@@ -60,6 +61,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
private bool _emergencyShuttleEnabled;
[ValidatePrototypeId<TagPrototype>]
private const string DockTag = "DockEmergency";
public override void Initialize()

View File

@@ -1,4 +1,4 @@
using System.Text;
using System.Text;
using System.Text.RegularExpressions;
using Content.Shared.Speech.Components;
using Content.Shared.Speech.EntitySystems;
@@ -9,6 +9,9 @@ namespace Content.Server.Speech.EntitySystems;
public sealed class RatvarianLanguageSystem : SharedRatvarianLanguageSystem
{
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
[ValidatePrototypeId<StatusEffectPrototype>]
private const string RatvarianKey = "RatvarianLanguage";
// This is the word of Ratvar and those who speak it shall abide by His rules:

View File

@@ -12,6 +12,7 @@ public sealed class SlurredSystem : SharedSlurredSystem
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[ValidatePrototypeId<StatusEffectPrototype>]
private const string SlurKey = "SlurredSpeech";
public override void Initialize()

View File

@@ -12,8 +12,6 @@ namespace Content.Server.Speech.EntitySystems
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
private const string StutterKey = "Stutter";
// Regex of characters to stutter.
private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz]",
RegexOptions.Compiled | RegexOptions.IgnoreCase);

View File

@@ -12,6 +12,7 @@ public sealed class KudzuSystem : EntitySystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[ValidatePrototypeId<EdgeSpreaderPrototype>]
private const string KudzuGroup = "kudzu";
/// <inheritdoc/>

View File

@@ -31,6 +31,7 @@ public sealed class SpreaderSystem : EntitySystem
private readonly List<string> _spreaderGroups = new();
[ValidatePrototypeId<TagPrototype>]
private const string IgnoredTag = "SpreaderIgnore";
/// <inheritdoc/>

View File

@@ -4,6 +4,7 @@ using Content.Shared.Inventory;
using Content.Shared.PDA;
using Content.Server.Store.Components;
using Content.Shared.FixedPoint;
using Content.Shared.Store;
namespace Content.Server.Traitor.Uplink
{
@@ -13,6 +14,7 @@ namespace Content.Server.Traitor.Uplink
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly StoreSystem _store = default!;
[ValidatePrototypeId<CurrencyPrototype>]
public const string TelecrystalCurrencyPrototype = "Telecrystal";
/// <summary>

View File

@@ -9,6 +9,7 @@ namespace Content.Server.Traits.Assorted;
/// </summary>
public sealed class NarcolepsySystem : EntitySystem
{
[ValidatePrototypeId<StatusEffectPrototype>]
private const string StatusEffectKey = "ForcedSleep"; // Same one used by N2O and other sleep chems.
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;

View File

@@ -20,7 +20,10 @@ public abstract class SharedChatSystem : EntitySystem
public const char AdminPrefix = ']';
public const char WhisperPrefix = ',';
public const char DefaultChannelKey = 'h';
[ValidatePrototypeId<RadioChannelPrototype>]
public const string CommonChannel = "Common";
public static string DefaultChannelPrefix = $"{RadioChannelPrefix}{DefaultChannelKey}";
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;

View File

@@ -1,4 +1,4 @@
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.Components;
using Content.Shared.Inventory.Events;
namespace Content.Shared.Chat.TypingIndicator;
@@ -11,8 +11,9 @@ public abstract class SharedTypingIndicatorSystem : EntitySystem
/// <summary>
/// Default ID of <see cref="TypingIndicatorPrototype"/>
/// </summary>
[ValidatePrototypeId<TypingIndicatorPrototype>]
public const string InitialIndicatorId = "default";
public override void Initialize()
{
base.Initialize();
@@ -25,7 +26,7 @@ public abstract class SharedTypingIndicatorSystem : EntitySystem
if (!TryComp<ClothingComponent>(uid, out var clothing) ||
!TryComp<TypingIndicatorComponent>(args.Equipee, out var indicator))
return;
var isCorrectSlot = clothing.Slots.HasFlag(args.SlotFlags);
if (!isCorrectSlot) return;

View File

@@ -6,6 +6,7 @@ namespace Content.Shared.Drunk;
public abstract class SharedDrunkSystem : EntitySystem
{
[ValidatePrototypeId<StatusEffectPrototype>]
public const string DrunkKey = "Drunk";
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;

View File

@@ -1,9 +1,11 @@
using Content.Shared.Eye.Blinding.Components;
using Content.Shared.StatusEffect;
namespace Content.Shared.Eye.Blinding.Systems;
public sealed class TemporaryBlindnessSystem : EntitySystem
{
[ValidatePrototypeId<StatusEffectPrototype>]
public const string BlindingStatusEffect = "TemporaryBlindness";
[Dependency] private readonly BlindableSystem _blindableSystem = default!;

View File

@@ -1,3 +1,4 @@
using Content.Shared.Tag;
using Robust.Shared.Audio;
namespace Content.Shared.Fluids.Components;
@@ -14,6 +15,8 @@ namespace Content.Shared.Fluids.Components;
public sealed class DrainComponent : Component
{
public const string SolutionName = "drainBuffer";
[ValidatePrototypeId<TagPrototype>]
public const string PlungerTag = "Plunger";
[DataField("accumulator")]

View File

@@ -1,4 +1,4 @@
using Robust.Shared.Network;
using Content.Shared.Roles;
using Robust.Shared.Replays;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Markdown.Mapping;
@@ -13,7 +13,9 @@ namespace Content.Shared.GameTicking
// See ideally these would be pulled from the job definition or something.
// But this is easier, and at least it isn't hardcoded.
//TODO: Move these, they really belong in StationJobsSystem or a cvar.
[ValidatePrototypeId<JobPrototype>]
public const string FallbackOverflowJob = "Passenger";
public const string FallbackOverflowJobName = "job-name-passenger";
// TODO network.

View File

@@ -1,8 +1,13 @@
using Content.Shared.Humanoid.Markings;
namespace Content.Shared.Humanoid
{
public static class HairStyles
{
[ValidatePrototypeId<MarkingPrototype>]
public const string DefaultHairStyle = "HairBald";
[ValidatePrototypeId<MarkingPrototype>]
public const string DefaultFacialHairStyle = "FacialHairShaved";
public static readonly IReadOnlyList<Color> RealisticHairColors = new List<Color>

View File

@@ -2,7 +2,6 @@ using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Linq;
using Content.Shared.Preferences;
using Robust.Shared.GameObjects.Components.Localization;
@@ -25,6 +24,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly MarkingManager _markingManager = default!;
[ValidatePrototypeId<SpeciesPrototype>]
public const string DefaultSpecies = "Human";
public override void Initialize()

View File

@@ -4,20 +4,21 @@ namespace Content.Shared.Speech.EntitySystems;
public abstract class SharedStutteringSystem : EntitySystem
{
[ValidatePrototypeId<StatusEffectPrototype>]
public const string StutterKey = "Stutter";
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
// For code in shared... I imagine we ain't getting accent prediction anytime soon so let's not bother.
public virtual void DoStutter(EntityUid uid, TimeSpan time, bool refresh, StatusEffectsComponent? status = null)
{
}
public virtual void DoRemoveStutterTime(EntityUid uid, double timeRemoved)
{
_statusEffectsSystem.TryRemoveTime(uid, StutterKey, TimeSpan.FromSeconds(timeRemoved));
}
public void DoRemoveStutter(EntityUid uid, double timeRemoved)
{
_statusEffectsSystem.TryRemoveStatusEffect(uid, StutterKey);