From c565b4496571dc7056f9fb6e179bd2f12a56da25 Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Mon, 7 Jul 2025 15:57:05 -0400 Subject: [PATCH] Replace `ValidatePrototypeId` uses with `ProtoId` or `EntProtoId` (#38814) * The easy ones * For certain values of easy * Easy test * Hair * Fix sandbox violations * Sort usings --- .../EntitySystems/ChemistryGuideDataSystem.cs | 12 ++--- .../UI/FlatpackCreatorMenu.xaml.cs | 3 +- .../CriminalRecordsConsoleWindow.xaml.cs | 5 +- .../Controls/GuideReagentReaction.xaml.cs | 5 +- .../Lobby/UI/HumanoidProfileEditor.xaml.cs | 23 ++++---- .../Systems/NetworkConfiguratorSystem.cs | 3 +- Content.Client/Overlays/ShowJobIconsSystem.cs | 5 +- Content.Client/Parallax/ParallaxSystem.cs | 3 +- .../Power/Generation/Teg/TegSystem.cs | 3 +- .../Silicons/Borgs/BorgSelectTypeMenu.xaml.cs | 1 - .../Silicons/Laws/Ui/LawDisplay.xaml.cs | 11 ++-- .../UserInterface/RichText/MonoTag.cs | 2 +- .../Systems/Chat/ChatUIController.cs | 5 +- .../Systems/Info/InfoUIController.cs | 5 +- .../Weapons/Ranged/Systems/GunSystem.cs | 3 +- .../Tests/Linter/StaticFieldValidationTest.cs | 9 ++-- .../Systems/AdminVerbSystem.Antags.cs | 27 +++------- Content.Server/Anomaly/AnomalySystem.cs | 5 +- .../Body/Commands/AddHandCommand.cs | 3 +- .../Cargo/Systems/CargoSystem.Bounty.cs | 3 +- .../Cartridges/CrewManifestCartridgeSystem.cs | 3 +- Content.Server/Chat/Systems/ChatSystem.cs | 3 +- .../EntitySystems/ChemMasterSystem.cs | 3 +- .../Construction/Commands/TileWallsCommand.cs | 10 ++-- .../Electrocution/ElectrocuteCommand.cs | 4 +- .../Electrocution/ElectrocutionSystem.cs | 10 ++-- .../EntitySystems/ExplosionSystem.cs | 5 +- .../Fluids/EntitySystems/PuddleSystem.cs | 17 +++--- .../GameTicking/GameTicker.Spawning.cs | 7 +-- Content.Server/GameTicking/GameTicker.cs | 2 +- .../GameTicking/Rules/NukeopsRuleSystem.cs | 10 ++-- .../Kitchen/EntitySystems/MicrowaveSystem.cs | 3 +- Content.Server/Mapping/MappingCommand.cs | 2 +- .../BiomassReclaimerSystem.cs | 6 +-- Content.Server/Medical/VomitSystem.cs | 3 +- Content.Server/Procedural/DungeonSystem.cs | 3 +- .../Revenant/EntitySystems/RevenantSystem.cs | 3 +- .../Salvage/SalvageSystem.Magnet.cs | 4 +- .../Salvage/SpawnSalvageMissionJob.cs | 2 +- .../Shuttles/Commands/FTLDiskCommand.cs | 7 +-- .../Systems/EmergencyShuttleSystem.Console.cs | 6 +-- .../Systems/EmergencyShuttleSystem.cs | 6 +-- Content.Server/Silicons/Borgs/BorgSystem.cs | 10 ++-- .../Silicons/Laws/IonStormSystem.cs | 54 +++++++------------ .../EntitySystems/RatvarianLanguageSystem.cs | 5 +- .../Speech/EntitySystems/SlurredSystem.cs | 6 +-- Content.Server/Spreader/KudzuSystem.cs | 4 +- .../Systems/StoreDiscountSystem.cs | 3 +- .../Temperature/Systems/TemperatureSystem.cs | 3 +- Content.Server/Traitor/Uplink/UplinkSystem.cs | 11 ++-- .../Artifact/XenoArtifactCommands.cs | 3 +- Content.Shared/Chat/SharedChatSystem.cs | 17 +++--- .../SharedTypingIndicatorSystem.cs | 4 +- .../Doors/Systems/SharedDoorSystem.cs | 5 +- Content.Shared/Drunk/DrunkSystem.cs | 4 +- .../Systems/TemporaryBlindnessSystem.cs | 4 +- .../Fluids/Components/DrainComponent.cs | 4 +- .../GameTicking/SharedGameTicker.cs | 3 +- Content.Shared/Gravity/SharedGravitySystem.cs | 4 +- Content.Shared/Humanoid/HairStyles.cs | 7 ++- .../Humanoid/HumanoidCharacterAppearance.cs | 4 +- .../SharedHumanoidAppearanceSystem.cs | 3 +- .../Inventory/InventorySystem.Equip.cs | 4 +- .../VirtualItem/SharedVirtualItemSystem.cs | 3 +- Content.Shared/Maps/ContentTileDefinition.cs | 3 +- .../Nutrition/EntitySystems/HungerSystem.cs | 11 ++-- .../Nutrition/EntitySystems/ThirstSystem.cs | 11 ++-- .../PlayTimeTrackingShared.cs | 7 ++- .../Preferences/HumanoidCharacterProfile.cs | 8 ++- .../Salvage/Fulton/SharedFultonSystem.cs | 2 +- Content.Shared/Salvage/SharedSalvageSystem.cs | 3 +- .../Silicons/Borgs/BorgTypePrototype.cs | 1 - .../Borgs/SharedBorgSwitchableTypeSystem.cs | 3 +- .../StationAi/SharedStationAiSystem.cs | 1 - .../EntitySystems/SharedStutteringSystem.cs | 4 +- .../SprayPainter/SharedSprayPainterSystem.cs | 5 +- .../EntitySystems/SharedStorageSystem.cs | 5 +- 77 files changed, 187 insertions(+), 297 deletions(-) diff --git a/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs b/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs index 374b00aa6e..3392545be8 100644 --- a/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs +++ b/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs @@ -18,14 +18,10 @@ public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem { [Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!; - [ValidatePrototypeId] - private const string DefaultMixingCategory = "DummyMix"; - [ValidatePrototypeId] - private const string DefaultGrindCategory = "DummyGrind"; - [ValidatePrototypeId] - private const string DefaultJuiceCategory = "DummyJuice"; - [ValidatePrototypeId] - private const string DefaultCondenseCategory = "DummyCondense"; + private static readonly ProtoId DefaultMixingCategory = "DummyMix"; + private static readonly ProtoId DefaultGrindCategory = "DummyGrind"; + private static readonly ProtoId DefaultJuiceCategory = "DummyJuice"; + private static readonly ProtoId DefaultCondenseCategory = "DummyCondense"; private readonly Dictionary> _reagentSources = new(); diff --git a/Content.Client/Construction/UI/FlatpackCreatorMenu.xaml.cs b/Content.Client/Construction/UI/FlatpackCreatorMenu.xaml.cs index 81410dc7e6..8ee8df48fd 100644 --- a/Content.Client/Construction/UI/FlatpackCreatorMenu.xaml.cs +++ b/Content.Client/Construction/UI/FlatpackCreatorMenu.xaml.cs @@ -27,8 +27,7 @@ public sealed partial class FlatpackCreatorMenu : FancyWindow private EntityUid _owner; - [ValidatePrototypeId] - public const string NoBoardEffectId = "FlatpackerNoBoardEffect"; + public static readonly EntProtoId NoBoardEffectId = "FlatpackerNoBoardEffect"; private EntityUid? _currentBoard = EntityUid.Invalid; diff --git a/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs b/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs index 5eaed77041..33b4fbc335 100644 --- a/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs +++ b/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs @@ -33,8 +33,7 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow public readonly EntityUid Console; - [ValidatePrototypeId] - private const string ReasonPlaceholders = "CriminalRecordsWantedReasonPlaceholders"; + private static readonly ProtoId ReasonPlaceholders = "CriminalRecordsWantedReasonPlaceholders"; public Action? OnKeySelected; public Action? OnFiltersChanged; @@ -296,7 +295,7 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow var field = "reason"; var title = Loc.GetString("criminal-records-status-" + status.ToString().ToLower()); - var placeholders = _proto.Index(ReasonPlaceholders); + var placeholders = _proto.Index(ReasonPlaceholders); var placeholder = Loc.GetString("criminal-records-console-reason-placeholder", ("placeholder", _random.Pick(placeholders))); // just funny it doesn't actually get used var prompt = Loc.GetString("criminal-records-console-reason"); var entry = new QuickDialogEntry(field, QuickDialogEntryType.LongText, prompt, placeholder); diff --git a/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs b/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs index 29ed124422..66d3f693b8 100644 --- a/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs +++ b/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs @@ -21,8 +21,7 @@ namespace Content.Client.Guidebook.Controls; [UsedImplicitly, GenerateTypedNameReferences] public sealed partial class GuideReagentReaction : BoxContainer, ISearchableControl { - [ValidatePrototypeId] - private const string DefaultMixingCategory = "DummyMix"; + private static readonly ProtoId DefaultMixingCategory = "DummyMix"; private readonly IPrototypeManager _protoMan; @@ -55,7 +54,7 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont } else { - mixingCategories.Add(protoMan.Index(DefaultMixingCategory)); + mixingCategories.Add(protoMan.Index(DefaultMixingCategory)); } SetMixingCategory(mixingCategories, prototype, sysMan); } diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs index f22d1416ca..12eb7ffc23 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs @@ -103,8 +103,7 @@ namespace Content.Client.Lobby.UI private bool _isDirty; - [ValidatePrototypeId] - private const string DefaultSpeciesGuidebook = "Species"; + private static readonly ProtoId DefaultSpeciesGuidebook = "Species"; public event Action>>? OnOpenGuidebook; @@ -809,9 +808,9 @@ namespace Content.Client.Lobby.UI var species = Profile?.Species ?? SharedHumanoidAppearanceSystem.DefaultSpecies; var page = DefaultSpeciesGuidebook; if (_prototypeManager.HasIndex(species)) - page = species; + page = new ProtoId(species.Id); // Gross. See above todo comment. - if (_prototypeManager.TryIndex(DefaultSpeciesGuidebook, out var guideRoot)) + if (_prototypeManager.TryIndex(DefaultSpeciesGuidebook, out var guideRoot)) { var dict = new Dictionary, GuideEntry>(); dict.Add(DefaultSpeciesGuidebook, guideRoot); @@ -1434,17 +1433,13 @@ namespace Content.Client.Lobby.UI { return; } - var hairMarking = Profile.Appearance.HairStyleId switch - { - HairStyles.DefaultHairStyle => new List(), - _ => new() { new(Profile.Appearance.HairStyleId, new List() { Profile.Appearance.HairColor }) }, - }; + var hairMarking = Profile.Appearance.HairStyleId == HairStyles.DefaultHairStyle + ? new List() + : new() { new(Profile.Appearance.HairStyleId, new List() { Profile.Appearance.HairColor }) }; - var facialHairMarking = Profile.Appearance.FacialHairStyleId switch - { - HairStyles.DefaultFacialHairStyle => new List(), - _ => new() { new(Profile.Appearance.FacialHairStyleId, new List() { Profile.Appearance.FacialHairColor }) }, - }; + var facialHairMarking = Profile.Appearance.FacialHairStyleId == HairStyles.DefaultFacialHairStyle + ? new List() + : new() { new(Profile.Appearance.FacialHairStyleId, new List() { Profile.Appearance.FacialHairColor }) }; HairStylePicker.UpdateData( hairMarking, diff --git a/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs b/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs index 8f519e61ac..9828222447 100644 --- a/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs +++ b/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs @@ -23,8 +23,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem [Dependency] private readonly ActionsSystem _actions = default!; [Dependency] private readonly IInputManager _inputManager = default!; - [ValidatePrototypeId] - private const string Action = "ActionClearNetworkLinkOverlays"; + private static readonly EntProtoId Action = "ActionClearNetworkLinkOverlays"; public override void Initialize() { diff --git a/Content.Client/Overlays/ShowJobIconsSystem.cs b/Content.Client/Overlays/ShowJobIconsSystem.cs index e5ba9b813f..d0d14449f6 100644 --- a/Content.Client/Overlays/ShowJobIconsSystem.cs +++ b/Content.Client/Overlays/ShowJobIconsSystem.cs @@ -13,8 +13,7 @@ public sealed class ShowJobIconsSystem : EquipmentHudSystem] - private const string JobIconForNoId = "JobIconNoId"; + private static readonly ProtoId JobIconForNoId = "JobIconNoId"; public override void Initialize() { @@ -52,7 +51,7 @@ public sealed class ShowJobIconsSystem : EquipmentHudSystem(iconId, out var iconPrototype)) + if (_prototype.TryIndex(iconId, out var iconPrototype)) ev.StatusIcons.Add(iconPrototype); else Log.Error($"Invalid job icon prototype: {iconPrototype}"); diff --git a/Content.Client/Parallax/ParallaxSystem.cs b/Content.Client/Parallax/ParallaxSystem.cs index 465bc9cef4..7fed53782a 100644 --- a/Content.Client/Parallax/ParallaxSystem.cs +++ b/Content.Client/Parallax/ParallaxSystem.cs @@ -14,8 +14,7 @@ public sealed class ParallaxSystem : SharedParallaxSystem [Dependency] private readonly IParallaxManager _parallax = default!; [Dependency] private readonly SharedMapSystem _map = default!; - [ValidatePrototypeId] - private const string Fallback = "Default"; + private static readonly ProtoId Fallback = "Default"; public const int ParallaxZIndex = 0; diff --git a/Content.Client/Power/Generation/Teg/TegSystem.cs b/Content.Client/Power/Generation/Teg/TegSystem.cs index 92b5062b6d..0ae1b5e496 100644 --- a/Content.Client/Power/Generation/Teg/TegSystem.cs +++ b/Content.Client/Power/Generation/Teg/TegSystem.cs @@ -15,8 +15,7 @@ namespace Content.Client.Power.Generation.Teg; /// public sealed class TegSystem : EntitySystem { - [ValidatePrototypeId] - private const string ArrowPrototype = "TegCirculatorArrow"; + private static readonly EntProtoId ArrowPrototype = "TegCirculatorArrow"; public override void Initialize() { diff --git a/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs b/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs index e1fbd376b5..be59b07b65 100644 --- a/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs +++ b/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs @@ -25,7 +25,6 @@ public sealed partial class BorgSelectTypeMenu : FancyWindow public event Action>? ConfirmedBorgType; - [ValidatePrototypeId] private static readonly List> GuidebookEntries = new() { "Cyborgs", "Robotics" }; public BorgSelectTypeMenu() diff --git a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs index bb0dba2f57..245ea194f0 100644 --- a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs +++ b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs @@ -84,12 +84,13 @@ public sealed partial class LawDisplay : Control radioChannelButton.OnPressed += _ => { - switch (radioChannel) + if (radioChannel == SharedChatSystem.CommonChannel) { - case SharedChatSystem.CommonChannel: - _chatManager.SendMessage($"{SharedChatSystem.RadioCommonPrefix} {lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Radio); break; - default: - _chatManager.SendMessage($"{SharedChatSystem.RadioChannelPrefix}{radioChannelProto.KeyCode} {lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Radio); break; + _chatManager.SendMessage($"{SharedChatSystem.RadioCommonPrefix} {lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Radio); + } + else + { + _chatManager.SendMessage($"{SharedChatSystem.RadioChannelPrefix}{radioChannelProto.KeyCode} {lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Radio); } _nextAllowedPress[radioChannelButton] = _timing.CurTime + PressCooldown; }; diff --git a/Content.Client/UserInterface/RichText/MonoTag.cs b/Content.Client/UserInterface/RichText/MonoTag.cs index aee41c324a..d97997dc83 100644 --- a/Content.Client/UserInterface/RichText/MonoTag.cs +++ b/Content.Client/UserInterface/RichText/MonoTag.cs @@ -12,7 +12,7 @@ namespace Content.Client.UserInterface.RichText; /// public sealed class MonoTag : IMarkupTag { - [ValidatePrototypeId] public const string MonoFont = "Monospace"; + public static readonly ProtoId MonoFont = "Monospace"; [Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; diff --git a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs index 13c6ff4a2a..e324429859 100644 --- a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs +++ b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs @@ -67,8 +67,7 @@ public sealed partial class ChatUIController : UIController [UISystemDependency] private readonly MindSystem? _mindSystem = default!; [UISystemDependency] private readonly RoleCodewordSystem? _roleCodewordSystem = default!; - [ValidatePrototypeId] - private const string ChatNamePalette = "ChatNames"; + private static readonly ProtoId ChatNamePalette = "ChatNames"; private string[] _chatNameColors = default!; private bool _chatNameColorsEnabled; @@ -232,7 +231,7 @@ public sealed partial class ChatUIController : UIController gameplayStateLoad.OnScreenLoad += OnScreenLoad; gameplayStateLoad.OnScreenUnload += OnScreenUnload; - var nameColors = _prototypeManager.Index(ChatNamePalette).Colors.Values.ToArray(); + var nameColors = _prototypeManager.Index(ChatNamePalette).Colors.Values.ToArray(); _chatNameColors = new string[nameColors.Length]; for (var i = 0; i < nameColors.Length; i++) { diff --git a/Content.Client/UserInterface/Systems/Info/InfoUIController.cs b/Content.Client/UserInterface/Systems/Info/InfoUIController.cs index 9f3461eadd..692ee26774 100644 --- a/Content.Client/UserInterface/Systems/Info/InfoUIController.cs +++ b/Content.Client/UserInterface/Systems/Info/InfoUIController.cs @@ -19,8 +19,7 @@ public sealed class InfoUIController : UIController, IOnStateExited] - private const string DefaultRuleset = "DefaultRuleset"; + private static readonly ProtoId DefaultRuleset = "DefaultRuleset"; public ProtoId RulesEntryId = DefaultRuleset; @@ -92,7 +91,7 @@ public sealed class InfoUIController : UIController, IOnStateExited(DefaultRuleset); + guideEntryPrototype = _prototype.Index(DefaultRuleset); Log.Error($"Couldn't find the following prototype: {RulesEntryId}. Falling back to {DefaultRuleset}, please check that the server has the rules set up correctly"); return guideEntryPrototype; } diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index dd26effb33..6abebda6ee 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -39,8 +39,7 @@ public sealed partial class GunSystem : SharedGunSystem [Dependency] private readonly SharedTransformSystem _xform = default!; [Dependency] private readonly SpriteSystem _sprite = default!; - [ValidatePrototypeId] - public const string HitscanProto = "HitscanEffect"; + public static readonly EntProtoId HitscanProto = "HitscanEffect"; public bool SpreadOverlay { diff --git a/Content.IntegrationTests/Tests/Linter/StaticFieldValidationTest.cs b/Content.IntegrationTests/Tests/Linter/StaticFieldValidationTest.cs index 90bf82e8f1..b75b81ab3c 100644 --- a/Content.IntegrationTests/Tests/Linter/StaticFieldValidationTest.cs +++ b/Content.IntegrationTests/Tests/Linter/StaticFieldValidationTest.cs @@ -4,7 +4,6 @@ using Content.Shared.Tag; using Robust.Shared.GameObjects; using Robust.Shared.Prototypes; using Robust.Shared.Reflection; -using Robust.Shared.Serialization.Manager.Attributes; namespace Content.IntegrationTests.Tests.Linter; @@ -66,25 +65,25 @@ public sealed class StaticFieldValidationTest [Reflect(false)] private sealed class StringValid { - [ValidatePrototypeId] public static string Tag = "StaticFieldTestTag"; + public static readonly ProtoId Tag = "StaticFieldTestTag"; } [Reflect(false)] private sealed class StringInvalid { - [ValidatePrototypeId] public static string Tag = string.Empty; + public static readonly ProtoId Tag = string.Empty; } [Reflect(false)] private sealed class StringArrayValid { - [ValidatePrototypeId] public static string[] Tag = ["StaticFieldTestTag", "StaticFieldTestTag"]; + public static readonly ProtoId[] Tag = ["StaticFieldTestTag", "StaticFieldTestTag"]; } [Reflect(false)] private sealed class StringArrayInvalid { - [ValidatePrototypeId] public static string[] Tag = [string.Empty, "StaticFieldTestTag", string.Empty]; + public static readonly ProtoId[] Tag = [string.Empty, "StaticFieldTestTag", string.Empty]; } [Reflect(false)] diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs index 6c7727ab4e..672ae695bf 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs @@ -22,25 +22,14 @@ public sealed partial class AdminVerbSystem [Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly OutfitSystem _outfit = default!; - [ValidatePrototypeId] - private const string DefaultTraitorRule = "Traitor"; + private static readonly EntProtoId DefaultTraitorRule = "Traitor"; + private static readonly EntProtoId DefaultInitialInfectedRule = "Zombie"; + private static readonly EntProtoId DefaultNukeOpRule = "LoneOpsSpawn"; + private static readonly EntProtoId DefaultRevsRule = "Revolutionary"; + private static readonly EntProtoId DefaultThiefRule = "Thief"; + private static readonly ProtoId PirateGearId = "PirateGear"; - [ValidatePrototypeId] - private const string DefaultInitialInfectedRule = "Zombie"; - - [ValidatePrototypeId] - private const string DefaultNukeOpRule = "LoneOpsSpawn"; - - [ValidatePrototypeId] - private const string DefaultRevsRule = "Revolutionary"; - - [ValidatePrototypeId] - private const string DefaultThiefRule = "Thief"; - - [ValidatePrototypeId] - private const string PirateGearId = "PirateGear"; - - private readonly EntProtoId _paradoxCloneRuleId = "ParadoxCloneSpawn"; + private static readonly EntProtoId ParadoxCloneRuleId = "ParadoxCloneSpawn"; // All antag verbs have names so invokeverb works. private void AddAntagVerbs(GetVerbsEvent args) @@ -172,7 +161,7 @@ public sealed partial class AdminVerbSystem Icon = new SpriteSpecifier.Rsi(new("/Textures/Interface/Misc/job_icons.rsi"), "ParadoxClone"), Act = () => { - var ruleEnt = _gameTicker.AddGameRule(_paradoxCloneRuleId); + var ruleEnt = _gameTicker.AddGameRule(ParadoxCloneRuleId); if (!TryComp(ruleEnt, out var paradoxCloneRuleComp)) return; diff --git a/Content.Server/Anomaly/AnomalySystem.cs b/Content.Server/Anomaly/AnomalySystem.cs index b0de3de8f3..9ac0ce7c94 100644 --- a/Content.Server/Anomaly/AnomalySystem.cs +++ b/Content.Server/Anomaly/AnomalySystem.cs @@ -44,8 +44,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem public const float MinParticleVariation = 0.8f; public const float MaxParticleVariation = 1.2f; - [ValidatePrototypeId] - const string WeightListProto = "AnomalyBehaviorList"; + private static readonly ProtoId WeightListProto = "AnomalyBehaviorList"; /// public override void Initialize() @@ -189,7 +188,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem #region Behavior private string GetRandomBehavior() { - var weightList = _prototype.Index(WeightListProto); + var weightList = _prototype.Index(WeightListProto); return weightList.Pick(_random); } diff --git a/Content.Server/Body/Commands/AddHandCommand.cs b/Content.Server/Body/Commands/AddHandCommand.cs index 3e006c539c..a28b07ef57 100644 --- a/Content.Server/Body/Commands/AddHandCommand.cs +++ b/Content.Server/Body/Commands/AddHandCommand.cs @@ -17,8 +17,7 @@ namespace Content.Server.Body.Commands [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly IRobustRandom _random = default!; - [ValidatePrototypeId] - public const string DefaultHandPrototype = "LeftHandHuman"; + private static readonly EntProtoId DefaultHandPrototype = "LeftHandHuman"; public string Command => "addhand"; public string Description => "Adds a hand to your entity."; diff --git a/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs b/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs index 456d979959..934517eadc 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs @@ -29,8 +29,7 @@ public sealed partial class CargoSystem [Dependency] private readonly NameIdentifierSystem _nameIdentifier = default!; [Dependency] private readonly EntityWhitelistSystem _whitelistSys = default!; - [ValidatePrototypeId] - private const string BountyNameIdentifierGroup = "Bounty"; + private static readonly ProtoId BountyNameIdentifierGroup = "Bounty"; private EntityQuery _stackQuery; private EntityQuery _containerQuery; diff --git a/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs b/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs index 5247aafbd5..b1b23b2732 100644 --- a/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs +++ b/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs @@ -16,8 +16,7 @@ public sealed class CrewManifestCartridgeSystem : EntitySystem [Dependency] private readonly CrewManifestSystem _crewManifest = default!; [Dependency] private readonly StationSystem _stationSystem = default!; - [ValidatePrototypeId] - private const string CartridgePrototypeName = "CrewManifestCartridge"; + private static readonly EntProtoId CartridgePrototypeName = "CrewManifestCartridge"; /// /// Flag that shows that if crew manifest is allowed to be viewed from 'unsecure' entities, diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 2d6fb3c275..f21c3f78aa 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -809,8 +809,7 @@ public sealed partial class ChatSystem : SharedChatSystem return message; } - [ValidatePrototypeId] - public const string ChatSanitize_Accent = "chatsanitize"; + public static readonly ProtoId ChatSanitize_Accent = "chatsanitize"; public string SanitizeMessageReplaceWords(string message) { diff --git a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs index 6e2e2a91bc..64350cbda1 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs @@ -39,8 +39,7 @@ namespace Content.Server.Chemistry.EntitySystems [Dependency] private readonly LabelSystem _labelSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; - [ValidatePrototypeId] - private const string PillPrototypeId = "Pill"; + private static readonly EntProtoId PillPrototypeId = "Pill"; public override void Initialize() { diff --git a/Content.Server/Construction/Commands/TileWallsCommand.cs b/Content.Server/Construction/Commands/TileWallsCommand.cs index a27caec423..ca87795b06 100644 --- a/Content.Server/Construction/Commands/TileWallsCommand.cs +++ b/Content.Server/Construction/Commands/TileWallsCommand.cs @@ -6,6 +6,7 @@ using Robust.Shared.Console; using Robust.Shared.Map; using Robust.Server.GameObjects; using Robust.Shared.Map.Components; +using Robust.Shared.Prototypes; namespace Content.Server.Construction.Commands; @@ -20,12 +21,9 @@ public sealed class TileWallsCommand : IConsoleCommand public string Description => "Puts an underplating tile below every wall on a grid."; public string Help => $"Usage: {Command} | {Command}"; - [ValidatePrototypeId] - public const string TilePrototypeId = "Plating"; - - [ValidatePrototypeId] - public const string WallTag = "Wall"; - public const string DiagonalTag = "Diagonal"; + public static readonly ProtoId TilePrototypeId = "Plating"; + public static readonly ProtoId WallTag = "Wall"; + public static readonly ProtoId DiagonalTag = "Diagonal"; public void Execute(IConsoleShell shell, string argStr, string[] args) { diff --git a/Content.Server/Electrocution/ElectrocuteCommand.cs b/Content.Server/Electrocution/ElectrocuteCommand.cs index c0d0ecf740..6bc3977544 100644 --- a/Content.Server/Electrocution/ElectrocuteCommand.cs +++ b/Content.Server/Electrocution/ElectrocuteCommand.cs @@ -2,6 +2,7 @@ using Content.Server.Administration; using Content.Shared.Administration; using Content.Shared.StatusEffect; using Robust.Shared.Console; +using Robust.Shared.Prototypes; namespace Content.Server.Electrocution; @@ -13,8 +14,7 @@ public sealed class ElectrocuteCommand : LocalizedEntityCommands public override string Command => "electrocute"; - [ValidatePrototypeId] - private const string ElectrocutionStatusEffect = "Electrocution"; + private static readonly ProtoId ElectrocutionStatusEffect = "Electrocution"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index cd2b69d2ce..18a4d52ac2 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -58,12 +58,8 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem [Dependency] private readonly MetaDataSystem _metaData = default!; [Dependency] private readonly TurfSystem _turf = default!; - [ValidatePrototypeId] - private const string StatusEffectKey = "Electrocution"; - - [ValidatePrototypeId] - private const string DamageType = "Shock"; - + private static readonly ProtoId StatusEffectKey = "Electrocution"; + private static readonly ProtoId DamageType = "Shock"; private static readonly ProtoId WindowTag = "Window"; // Multiply and shift the log scale for shock damage. @@ -408,7 +404,7 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem if (shockDamage is { } dmg) { var actual = _damageable.TryChangeDamage(uid, - new DamageSpecifier(_prototypeManager.Index(DamageType), dmg), origin: sourceUid); + new DamageSpecifier(_prototypeManager.Index(DamageType), dmg), origin: sourceUid); if (actual != null) { diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 0cdc6d6b23..c50b1e53fa 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -70,14 +70,13 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem /// 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. /// - [ValidatePrototypeId] - public const string DefaultExplosionPrototypeId = "Default"; + public static readonly ProtoId DefaultExplosionPrototypeId = "Default"; public override void Initialize() { base.Initialize(); - DebugTools.Assert(_prototypeManager.HasIndex(DefaultExplosionPrototypeId)); + DebugTools.Assert(_prototypeManager.HasIndex(DefaultExplosionPrototypeId)); // handled in ExplosionSystem.GridMap.cs SubscribeLocalEvent(OnGridRemoved); diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index ca2a2a64f3..44bbfe2450 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -60,16 +60,11 @@ public sealed partial class PuddleSystem : SharedPuddleSystem [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly TurfSystem _turf = default!; - [ValidatePrototypeId] - private const string Blood = "Blood"; + private static readonly ProtoId Blood = "Blood"; + private static readonly ProtoId Slime = "Slime"; + private static readonly ProtoId CopperBlood = "CopperBlood"; - [ValidatePrototypeId] - private const string Slime = "Slime"; - - [ValidatePrototypeId] - private const string CopperBlood = "CopperBlood"; - - private static string[] _standoutReagents = [Blood, Slime, CopperBlood]; + private static readonly string[] StandoutReagents = [Blood, Slime, CopperBlood]; // Using local deletion queue instead of the standard queue so that we can easily "undelete" if a puddle // loses & then gains reagents in a single tick. @@ -362,10 +357,10 @@ public sealed partial class PuddleSystem : SharedPuddleSystem // Kinda EH // Could potentially do alpha per-solution but future problem. - color = solution.GetColorWithout(_prototypeManager, _standoutReagents); + color = solution.GetColorWithout(_prototypeManager, StandoutReagents); color = color.WithAlpha(0.7f); - foreach (var standout in _standoutReagents) + foreach (var standout in StandoutReagents) { var quantity = solution.GetTotalPrototypeQuantity(standout); if (quantity <= FixedPoint2.Zero) diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index c59028e69b..194f6c4997 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -36,11 +36,8 @@ namespace Content.Server.GameTicking [Dependency] private readonly SharedJobSystem _jobs = default!; [Dependency] private readonly AdminSystem _admin = default!; - [ValidatePrototypeId] - public const string ObserverPrototypeName = "MobObserver"; - - [ValidatePrototypeId] - public const string AdminObserverPrototypeName = "AdminObserver"; + public static readonly EntProtoId ObserverPrototypeName = "MobObserver"; + public static readonly EntProtoId AdminObserverPrototypeName = "AdminObserver"; /// /// How many players have joined the round through normal methods. diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index fa8314cd27..55bf51db02 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -93,7 +93,7 @@ namespace Content.Server.GameTicking InitializePlayer(); InitializeLobbyBackground(); InitializeGamePreset(); - DebugTools.Assert(_prototypeManager.Index(FallbackOverflowJob).Name == FallbackOverflowJobName, + DebugTools.Assert(_prototypeManager.Index(FallbackOverflowJob).Name == FallbackOverflowJobName, "Overflow role does not have the correct name!"); InitializeGameRules(); InitializeReplays(); diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index 616a1e48ff..f687c9dcc7 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -25,6 +25,7 @@ using Robust.Shared.Random; using Robust.Shared.Utility; using System.Linq; using Content.Shared.Store.Components; +using Robust.Shared.Prototypes; namespace Content.Server.GameTicking.Rules; @@ -38,11 +39,8 @@ public sealed class NukeopsRuleSystem : GameRuleSystem [Dependency] private readonly StoreSystem _store = default!; [Dependency] private readonly TagSystem _tag = default!; - [ValidatePrototypeId] - private const string TelecrystalCurrencyPrototype = "Telecrystal"; - - [ValidatePrototypeId] - private const string NukeOpsUplinkTagPrototype = "NukeOpsUplink"; + private static readonly ProtoId TelecrystalCurrencyPrototype = "Telecrystal"; + private static readonly ProtoId NukeOpsUplinkTagPrototype = "NukeOpsUplink"; public override void Initialize() @@ -485,7 +483,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem SetWinType(ent, WinType.CrewMajor, false); - if (nukeops.RoundEndBehavior == RoundEndBehavior.Nothing) // It's still worth checking if operatives have all died, even if the round-end behaviour is nothing. + if (nukeops.RoundEndBehavior == RoundEndBehavior.Nothing) // It's still worth checking if operatives have all died, even if the round-end behaviour is nothing. return; // Shouldn't actually try to end the round in the case of nothing though. _roundEndSystem.DoRoundEndBehavior(nukeops.RoundEndBehavior, diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index 07ced93085..f5c8c4d0d8 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -70,8 +70,7 @@ namespace Content.Server.Kitchen.EntitySystems [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedSuicideSystem _suicide = default!; - [ValidatePrototypeId] - private const string MalfunctionSpark = "Spark"; + private static readonly EntProtoId MalfunctionSpark = "Spark"; private static readonly ProtoId MetalTag = "Metal"; private static readonly ProtoId PlasticTag = "Plastic"; diff --git a/Content.Server/Mapping/MappingCommand.cs b/Content.Server/Mapping/MappingCommand.cs index 96a21573f6..8081b8e45f 100644 --- a/Content.Server/Mapping/MappingCommand.cs +++ b/Content.Server/Mapping/MappingCommand.cs @@ -146,7 +146,7 @@ namespace Content.Server.Mapping // map successfully created. run misc helpful mapping commands if (player.AttachedEntity is { Valid: true } playerEntity && - EntityManager.GetComponent(playerEntity).EntityPrototype?.ID != GameTicker.AdminObserverPrototypeName) + (EntityManager.GetComponent(playerEntity).EntityPrototype is not { } proto || proto != GameTicker.AdminObserverPrototypeName)) { shell.ExecuteCommand("aghost"); } diff --git a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs index 42e455a47f..e029071574 100644 --- a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs +++ b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs @@ -17,9 +17,9 @@ using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Inventory; using Content.Shared.Jittering; +using Content.Shared.Materials; using Content.Shared.Medical; using Content.Shared.Mind; -using Content.Shared.Materials; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.Nutrition.Components; @@ -30,6 +30,7 @@ using Robust.Server.Player; using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Physics.Components; +using Robust.Shared.Prototypes; using Robust.Shared.Random; namespace Content.Server.Medical.BiomassReclaimer @@ -53,8 +54,7 @@ namespace Content.Server.Medical.BiomassReclaimer [Dependency] private readonly SharedMindSystem _minds = default!; [Dependency] private readonly InventorySystem _inventory = default!; - [ValidatePrototypeId] - public const string BiomassPrototype = "Biomass"; + public static readonly ProtoId BiomassPrototype = "Biomass"; public override void Update(float frameTime) { diff --git a/Content.Server/Medical/VomitSystem.cs b/Content.Server/Medical/VomitSystem.cs index 66cc9bf5f6..7b8be07a15 100644 --- a/Content.Server/Medical/VomitSystem.cs +++ b/Content.Server/Medical/VomitSystem.cs @@ -32,8 +32,7 @@ namespace Content.Server.Medical [Dependency] private readonly ForensicsSystem _forensics = default!; [Dependency] private readonly BloodstreamSystem _bloodstream = default!; - [ValidatePrototypeId] - private const string VomitCollection = "Vomit"; + private static readonly ProtoId VomitCollection = "Vomit"; private readonly SoundSpecifier _vomitSound = new SoundCollectionSpecifier(VomitCollection, AudioParams.Default.WithVariation(0.2f).WithVolume(-4f)); diff --git a/Content.Server/Procedural/DungeonSystem.cs b/Content.Server/Procedural/DungeonSystem.cs index 3a0a7ab2cd..aac620acc0 100644 --- a/Content.Server/Procedural/DungeonSystem.cs +++ b/Content.Server/Procedural/DungeonSystem.cs @@ -54,8 +54,7 @@ public sealed partial class DungeonSystem : SharedDungeonSystem private readonly JobQueue _dungeonJobQueue = new(DungeonJobTime); private readonly Dictionary _dungeonJobs = new(); - [ValidatePrototypeId] - public const string FallbackTileId = "FloorSteel"; + public static readonly ProtoId FallbackTileId = "FloorSteel"; public override void Initialize() { diff --git a/Content.Server/Revenant/EntitySystems/RevenantSystem.cs b/Content.Server/Revenant/EntitySystems/RevenantSystem.cs index 0501f5afc3..2d38aee6ea 100644 --- a/Content.Server/Revenant/EntitySystems/RevenantSystem.cs +++ b/Content.Server/Revenant/EntitySystems/RevenantSystem.cs @@ -47,8 +47,7 @@ public sealed partial class RevenantSystem : EntitySystem [Dependency] private readonly VisibilitySystem _visibility = default!; [Dependency] private readonly TurfSystem _turf = default!; - [ValidatePrototypeId] - private const string RevenantShopId = "ActionRevenantShop"; + private static readonly EntProtoId RevenantShopId = "ActionRevenantShop"; public override void Initialize() { diff --git a/Content.Server/Salvage/SalvageSystem.Magnet.cs b/Content.Server/Salvage/SalvageSystem.Magnet.cs index 41d4c2e755..ee5cd792c6 100644 --- a/Content.Server/Salvage/SalvageSystem.Magnet.cs +++ b/Content.Server/Salvage/SalvageSystem.Magnet.cs @@ -8,6 +8,7 @@ using Content.Shared.Radio; using Content.Shared.Salvage.Magnet; using Robust.Shared.Exceptions; using Robust.Shared.Map; +using Robust.Shared.Prototypes; namespace Content.Server.Salvage; @@ -15,8 +16,7 @@ public sealed partial class SalvageSystem { [Dependency] private readonly IRuntimeLog _runtimeLog = default!; - [ValidatePrototypeId] - private const string MagnetChannel = "Supply"; + private static readonly ProtoId MagnetChannel = "Supply"; private EntityQuery _salvMobQuery; private EntityQuery _mobStateQuery; diff --git a/Content.Server/Salvage/SpawnSalvageMissionJob.cs b/Content.Server/Salvage/SpawnSalvageMissionJob.cs index 8b5e9898ad..75b22598f9 100644 --- a/Content.Server/Salvage/SpawnSalvageMissionJob.cs +++ b/Content.Server/Salvage/SpawnSalvageMissionJob.cs @@ -255,7 +255,7 @@ public sealed class SpawnSalvageMissionJob : Job } } - var allLoot = _prototypeManager.Index(SharedSalvageSystem.ExpeditionsLootProto); + var allLoot = _prototypeManager.Index(SharedSalvageSystem.ExpeditionsLootProto); var lootBudget = difficultyProto.LootBudget; foreach (var rule in allLoot.LootRules) diff --git a/Content.Server/Shuttles/Commands/FTLDiskCommand.cs b/Content.Server/Shuttles/Commands/FTLDiskCommand.cs index 63d45e2364..5d7c108e5d 100644 --- a/Content.Server/Shuttles/Commands/FTLDiskCommand.cs +++ b/Content.Server/Shuttles/Commands/FTLDiskCommand.cs @@ -25,11 +25,8 @@ public sealed class FTLDiskCommand : LocalizedCommands public override string Command => "ftldisk"; - [ValidatePrototypeId] - public const string CoordinatesDisk = "CoordinatesDisk"; - - [ValidatePrototypeId] - public const string DiskCase = "DiskCase"; + public static readonly EntProtoId CoordinatesDisk = "CoordinatesDisk"; + public static readonly EntProtoId DiskCase = "DiskCase"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length == 0) diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs index 95c6ab5a1b..e07b522c5a 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs @@ -6,6 +6,7 @@ using Content.Shared.Access; using Content.Shared.CCVar; using Content.Shared.Database; using Content.Shared.DeviceNetwork; +using Content.Shared.DeviceNetwork.Components; using Content.Shared.Popups; using Content.Shared.Shuttles.BUIStates; using Content.Shared.Shuttles.Events; @@ -13,7 +14,7 @@ using Content.Shared.Shuttles.Systems; using Content.Shared.UserInterface; using Robust.Shared.Map; using Robust.Shared.Player; -using Content.Shared.DeviceNetwork.Components; +using Robust.Shared.Prototypes; using Timer = Robust.Shared.Timing.Timer; namespace Content.Server.Shuttles.Systems; @@ -65,8 +66,7 @@ public sealed partial class EmergencyShuttleSystem private CancellationTokenSource? _roundEndCancelToken; - [ValidatePrototypeId] - private const string EmergencyRepealAllAccess = "EmergencyShuttleRepealAll"; + private static readonly ProtoId EmergencyRepealAllAccess = "EmergencyShuttleRepealAll"; private static readonly Color DangerColor = Color.Red; /// diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 94e028b402..9eff1455f9 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -21,6 +21,7 @@ using Content.Shared.Access.Systems; using Content.Shared.CCVar; using Content.Shared.Database; using Content.Shared.DeviceNetwork; +using Content.Shared.DeviceNetwork.Components; using Content.Shared.GameTicking; using Content.Shared.Localizations; using Content.Shared.Shuttles.Components; @@ -33,10 +34,10 @@ using Robust.Shared.Configuration; using Robust.Shared.EntitySerialization.Systems; using Robust.Shared.Map.Components; using Robust.Shared.Player; +using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; -using Content.Shared.DeviceNetwork.Components; namespace Content.Server.Shuttles.Systems; @@ -73,8 +74,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem private bool _emergencyShuttleEnabled; - [ValidatePrototypeId] - private const string DockTag = "DockEmergency"; + private static readonly ProtoId DockTag = "DockEmergency"; public override void Initialize() { diff --git a/Content.Server/Silicons/Borgs/BorgSystem.cs b/Content.Server/Silicons/Borgs/BorgSystem.cs index fd40aa8816..0cd407000f 100644 --- a/Content.Server/Silicons/Borgs/BorgSystem.cs +++ b/Content.Server/Silicons/Borgs/BorgSystem.cs @@ -1,12 +1,14 @@ +using System.Diagnostics.CodeAnalysis; +using System.Linq; using Content.Server.Actions; using Content.Server.Administration.Logs; using Content.Server.Administration.Managers; -using Content.Shared.Body.Events; using Content.Server.DeviceNetwork.Systems; using Content.Server.Explosion.EntitySystems; using Content.Server.Hands.Systems; using Content.Server.PowerCell; using Content.Shared.Alert; +using Content.Shared.Body.Events; using Content.Shared.Database; using Content.Shared.IdentityManagement; using Content.Shared.Interaction; @@ -29,10 +31,9 @@ using Robust.Server.GameObjects; using Robust.Shared.Configuration; using Robust.Shared.Containers; using Robust.Shared.Player; +using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; -using System.Diagnostics.CodeAnalysis; -using System.Linq; namespace Content.Server.Silicons.Borgs; @@ -61,8 +62,7 @@ public sealed partial class BorgSystem : SharedBorgSystem [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; [Dependency] private readonly ISharedPlayerManager _player = default!; - [ValidatePrototypeId] - public const string BorgJobId = "Borg"; + public static readonly ProtoId BorgJobId = "Borg"; /// public override void Initialize() diff --git a/Content.Server/Silicons/Laws/IonStormSystem.cs b/Content.Server/Silicons/Laws/IonStormSystem.cs index 7b848a0ea6..249813edc1 100644 --- a/Content.Server/Silicons/Laws/IonStormSystem.cs +++ b/Content.Server/Silicons/Laws/IonStormSystem.cs @@ -22,42 +22,24 @@ public sealed class IonStormSystem : EntitySystem [Dependency] private readonly IRobustRandom _robustRandom = default!; // funny - [ValidatePrototypeId] - private const string Threats = "IonStormThreats"; - [ValidatePrototypeId] - private const string Objects = "IonStormObjects"; - [ValidatePrototypeId] - private const string Crew = "IonStormCrew"; - [ValidatePrototypeId] - private const string Adjectives = "IonStormAdjectives"; - [ValidatePrototypeId] - private const string Verbs = "IonStormVerbs"; - [ValidatePrototypeId] - private const string NumberBase = "IonStormNumberBase"; - [ValidatePrototypeId] - private const string NumberMod = "IonStormNumberMod"; - [ValidatePrototypeId] - private const string Areas = "IonStormAreas"; - [ValidatePrototypeId] - private const string Feelings = "IonStormFeelings"; - [ValidatePrototypeId] - private const string FeelingsPlural = "IonStormFeelingsPlural"; - [ValidatePrototypeId] - private const string Musts = "IonStormMusts"; - [ValidatePrototypeId] - private const string Requires = "IonStormRequires"; - [ValidatePrototypeId] - private const string Actions = "IonStormActions"; - [ValidatePrototypeId] - private const string Allergies = "IonStormAllergies"; - [ValidatePrototypeId] - private const string AllergySeverities = "IonStormAllergySeverities"; - [ValidatePrototypeId] - private const string Concepts = "IonStormConcepts"; - [ValidatePrototypeId] - private const string Drinks = "IonStormDrinks"; - [ValidatePrototypeId] - private const string Foods = "IonStormFoods"; + private static readonly ProtoId Threats = "IonStormThreats"; + private static readonly ProtoId Objects = "IonStormObjects"; + private static readonly ProtoId Crew = "IonStormCrew"; + private static readonly ProtoId Adjectives = "IonStormAdjectives"; + private static readonly ProtoId Verbs = "IonStormVerbs"; + private static readonly ProtoId NumberBase = "IonStormNumberBase"; + private static readonly ProtoId NumberMod = "IonStormNumberMod"; + private static readonly ProtoId Areas = "IonStormAreas"; + private static readonly ProtoId Feelings = "IonStormFeelings"; + private static readonly ProtoId FeelingsPlural = "IonStormFeelingsPlural"; + private static readonly ProtoId Musts = "IonStormMusts"; + private static readonly ProtoId Requires = "IonStormRequires"; + private static readonly ProtoId Actions = "IonStormActions"; + private static readonly ProtoId Allergies = "IonStormAllergies"; + private static readonly ProtoId AllergySeverities = "IonStormAllergySeverities"; + private static readonly ProtoId Concepts = "IonStormConcepts"; + private static readonly ProtoId Drinks = "IonStormDrinks"; + private static readonly ProtoId Foods = "IonStormFoods"; /// /// Randomly alters the laws of an individual silicon. diff --git a/Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs b/Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs index baa4f6f347..508f85aac2 100644 --- a/Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs +++ b/Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs @@ -3,6 +3,7 @@ using System.Text.RegularExpressions; using Content.Shared.Speech.Components; using Content.Shared.Speech.EntitySystems; using Content.Shared.StatusEffect; +using Robust.Shared.Prototypes; namespace Content.Server.Speech.EntitySystems; @@ -10,9 +11,7 @@ public sealed class RatvarianLanguageSystem : SharedRatvarianLanguageSystem { [Dependency] private readonly StatusEffectsSystem _statusEffects = default!; - - [ValidatePrototypeId] - private const string RatvarianKey = "RatvarianLanguage"; + private static readonly ProtoId RatvarianKey = "RatvarianLanguage"; // This is the word of Ratvar and those who speak it shall abide by His rules: /* diff --git a/Content.Server/Speech/EntitySystems/SlurredSystem.cs b/Content.Server/Speech/EntitySystems/SlurredSystem.cs index e396cd0b18..fbfe72f17f 100644 --- a/Content.Server/Speech/EntitySystems/SlurredSystem.cs +++ b/Content.Server/Speech/EntitySystems/SlurredSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Speech.Components; using Content.Shared.Drunk; using Content.Shared.Speech.EntitySystems; using Content.Shared.StatusEffect; +using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -14,10 +15,7 @@ public sealed class SlurredSystem : SharedSlurredSystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IGameTiming _timing = default!; - - - [ValidatePrototypeId] - private const string SlurKey = "SlurredSpeech"; + private static readonly ProtoId SlurKey = "SlurredSpeech"; public override void Initialize() { diff --git a/Content.Server/Spreader/KudzuSystem.cs b/Content.Server/Spreader/KudzuSystem.cs index 92e6609fd7..fbc809c15b 100644 --- a/Content.Server/Spreader/KudzuSystem.cs +++ b/Content.Server/Spreader/KudzuSystem.cs @@ -1,5 +1,6 @@ using Content.Shared.Damage; using Content.Shared.Spreader; +using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -14,8 +15,7 @@ public sealed class KudzuSystem : EntitySystem [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly DamageableSystem _damageable = default!; - [ValidatePrototypeId] - private const string KudzuGroup = "Kudzu"; + private static readonly ProtoId KudzuGroup = "Kudzu"; /// public override void Initialize() diff --git a/Content.Server/StoreDiscount/Systems/StoreDiscountSystem.cs b/Content.Server/StoreDiscount/Systems/StoreDiscountSystem.cs index c993c14694..dc72a08499 100644 --- a/Content.Server/StoreDiscount/Systems/StoreDiscountSystem.cs +++ b/Content.Server/StoreDiscount/Systems/StoreDiscountSystem.cs @@ -14,8 +14,7 @@ namespace Content.Server.StoreDiscount.Systems; /// public sealed class StoreDiscountSystem : EntitySystem { - [ValidatePrototypeId] - private const string DiscountedStoreCategoryPrototypeKey = "DiscountedItems"; + private static readonly ProtoId DiscountedStoreCategoryPrototypeKey = "DiscountedItems"; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; diff --git a/Content.Server/Temperature/Systems/TemperatureSystem.cs b/Content.Server/Temperature/Systems/TemperatureSystem.cs index d2f6baf6f9..6290e8231a 100644 --- a/Content.Server/Temperature/Systems/TemperatureSystem.cs +++ b/Content.Server/Temperature/Systems/TemperatureSystem.cs @@ -36,8 +36,7 @@ public sealed class TemperatureSystem : EntitySystem private float _accumulatedFrametime; - [ValidatePrototypeId] - public const string TemperatureAlertCategory = "Temperature"; + public static readonly ProtoId TemperatureAlertCategory = "Temperature"; public override void Initialize() { diff --git a/Content.Server/Traitor/Uplink/UplinkSystem.cs b/Content.Server/Traitor/Uplink/UplinkSystem.cs index f30d2d7b4c..f4a9ca75fd 100644 --- a/Content.Server/Traitor/Uplink/UplinkSystem.cs +++ b/Content.Server/Traitor/Uplink/UplinkSystem.cs @@ -22,10 +22,9 @@ public sealed class UplinkSystem : EntitySystem [Dependency] private readonly SharedSubdermalImplantSystem _subdermalImplant = default!; [Dependency] private readonly SharedMindSystem _mind = default!; - [ValidatePrototypeId] - public const string TelecrystalCurrencyPrototype = "Telecrystal"; - private const string FallbackUplinkImplant = "UplinkImplant"; - private const string FallbackUplinkCatalog = "UplinkUplinkImplanter"; + public static readonly ProtoId TelecrystalCurrencyPrototype = "Telecrystal"; + private static readonly EntProtoId FallbackUplinkImplant = "UplinkImplant"; + private static readonly ProtoId FallbackUplinkCatalog = "UplinkUplinkImplanter"; /// /// Adds an uplink to the target @@ -89,8 +88,6 @@ public sealed class UplinkSystem : EntitySystem /// private bool ImplantUplink(EntityUid user, FixedPoint2 balance, bool giveDiscounts) { - var implantProto = new string(FallbackUplinkImplant); - if (!_proto.TryIndex(FallbackUplinkCatalog, out var catalog)) return false; @@ -102,7 +99,7 @@ public sealed class UplinkSystem : EntitySystem else balance = balance - cost; - var implant = _subdermalImplant.AddImplant(user, implantProto); + var implant = _subdermalImplant.AddImplant(user, FallbackUplinkImplant); if (!HasComp(implant)) return false; diff --git a/Content.Server/Xenoarchaeology/Artifact/XenoArtifactCommands.cs b/Content.Server/Xenoarchaeology/Artifact/XenoArtifactCommands.cs index 31d079e3ad..7fd7acca4b 100644 --- a/Content.Server/Xenoarchaeology/Artifact/XenoArtifactCommands.cs +++ b/Content.Server/Xenoarchaeology/Artifact/XenoArtifactCommands.cs @@ -14,8 +14,7 @@ namespace Content.Server.Xenoarchaeology.Artifact; [ToolshedCommand, AdminCommand(AdminFlags.Debug)] public sealed class XenoArtifactCommand : ToolshedCommand { - [ValidatePrototypeId] - public const string ArtifactPrototype = "BaseXenoArtifact"; + public static readonly EntProtoId ArtifactPrototype = "BaseXenoArtifact"; /// List existing artifacts. [CommandImplementation("list")] diff --git a/Content.Shared/Chat/SharedChatSystem.cs b/Content.Shared/Chat/SharedChatSystem.cs index e5f3d46997..967980302d 100644 --- a/Content.Shared/Chat/SharedChatSystem.cs +++ b/Content.Shared/Chat/SharedChatSystem.cs @@ -24,13 +24,10 @@ public abstract class SharedChatSystem : EntitySystem public const char WhisperPrefix = ','; public const char DefaultChannelKey = 'h'; - [ValidatePrototypeId] - public const string CommonChannel = "Common"; + public static readonly ProtoId CommonChannel = "Common"; - public static string DefaultChannelPrefix = $"{RadioChannelPrefix}{DefaultChannelKey}"; - - [ValidatePrototypeId] - public const string DefaultSpeechVerb = "Default"; + public static readonly string DefaultChannelPrefix = $"{RadioChannelPrefix}{DefaultChannelKey}"; + public static readonly ProtoId DefaultSpeechVerb = "Default"; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; @@ -43,7 +40,7 @@ public abstract class SharedChatSystem : EntitySystem public override void Initialize() { base.Initialize(); - DebugTools.Assert(_prototypeManager.HasIndex(CommonChannel)); + DebugTools.Assert(_prototypeManager.HasIndex(CommonChannel)); SubscribeLocalEvent(OnPrototypeReload); CacheRadios(); } @@ -67,13 +64,13 @@ public abstract class SharedChatSystem : EntitySystem public SpeechVerbPrototype GetSpeechVerb(EntityUid source, string message, SpeechComponent? speech = null) { if (!Resolve(source, ref speech, false)) - return _prototypeManager.Index(DefaultSpeechVerb); + return _prototypeManager.Index(DefaultSpeechVerb); // check for a suffix-applicable speech verb SpeechVerbPrototype? current = null; foreach (var (str, id) in speech.SuffixSpeechVerbs) { - var proto = _prototypeManager.Index(id); + var proto = _prototypeManager.Index(id); if (message.EndsWith(Loc.GetString(str)) && proto.Priority >= (current?.Priority ?? 0)) { current = proto; @@ -81,7 +78,7 @@ public abstract class SharedChatSystem : EntitySystem } // if no applicable suffix verb return the normal one used by the entity - return current ?? _prototypeManager.Index(speech.SpeechVerb); + return current ?? _prototypeManager.Index(speech.SpeechVerb); } /// diff --git a/Content.Shared/Chat/TypingIndicator/SharedTypingIndicatorSystem.cs b/Content.Shared/Chat/TypingIndicator/SharedTypingIndicatorSystem.cs index bc5c95c8ab..20f2741f0b 100644 --- a/Content.Shared/Chat/TypingIndicator/SharedTypingIndicatorSystem.cs +++ b/Content.Shared/Chat/TypingIndicator/SharedTypingIndicatorSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.ActionBlocker; using Content.Shared.Clothing; using Content.Shared.Inventory; using Robust.Shared.Player; +using Robust.Shared.Prototypes; using Robust.Shared.Timing; namespace Content.Shared.Chat.TypingIndicator; @@ -18,8 +19,7 @@ public abstract class SharedTypingIndicatorSystem : EntitySystem /// /// Default ID of /// - [ValidatePrototypeId] - public const string InitialIndicatorId = "default"; + public static readonly ProtoId InitialIndicatorId = "default"; public override void Initialize() { diff --git a/Content.Shared/Doors/Systems/SharedDoorSystem.cs b/Content.Shared/Doors/Systems/SharedDoorSystem.cs index a0dba80bd9..7914a38334 100644 --- a/Content.Shared/Doors/Systems/SharedDoorSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorSystem.cs @@ -23,6 +23,7 @@ using Robust.Shared.Timing; using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Map.Components; +using Robust.Shared.Prototypes; namespace Content.Shared.Doors.Systems; @@ -46,9 +47,7 @@ public abstract partial class SharedDoorSystem : EntitySystem [Dependency] private readonly SharedMapSystem _mapSystem = default!; [Dependency] private readonly SharedPowerReceiverSystem _powerReceiver = default!; - - [ValidatePrototypeId] - public const string DoorBumpTag = "DoorBumpOpener"; + public static readonly ProtoId DoorBumpTag = "DoorBumpOpener"; /// /// A set of doors that are currently opening, closing, or just queued to open/close after some delay. diff --git a/Content.Shared/Drunk/DrunkSystem.cs b/Content.Shared/Drunk/DrunkSystem.cs index 4f9429b6a6..236ce2dcd3 100644 --- a/Content.Shared/Drunk/DrunkSystem.cs +++ b/Content.Shared/Drunk/DrunkSystem.cs @@ -1,13 +1,13 @@ using Content.Shared.Speech.EntitySystems; using Content.Shared.StatusEffect; using Content.Shared.Traits.Assorted; +using Robust.Shared.Prototypes; namespace Content.Shared.Drunk; public abstract class SharedDrunkSystem : EntitySystem { - [ValidatePrototypeId] - public const string DrunkKey = "Drunk"; + public static readonly ProtoId DrunkKey = "Drunk"; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly SharedSlurredSystem _slurredSystem = default!; diff --git a/Content.Shared/Eye/Blinding/Systems/TemporaryBlindnessSystem.cs b/Content.Shared/Eye/Blinding/Systems/TemporaryBlindnessSystem.cs index aa3ff9fdc3..34680b12ef 100644 --- a/Content.Shared/Eye/Blinding/Systems/TemporaryBlindnessSystem.cs +++ b/Content.Shared/Eye/Blinding/Systems/TemporaryBlindnessSystem.cs @@ -1,12 +1,12 @@ using Content.Shared.Eye.Blinding.Components; using Content.Shared.StatusEffect; +using Robust.Shared.Prototypes; namespace Content.Shared.Eye.Blinding.Systems; public sealed class TemporaryBlindnessSystem : EntitySystem { - [ValidatePrototypeId] - public const string BlindingStatusEffect = "TemporaryBlindness"; + public static readonly ProtoId BlindingStatusEffect = "TemporaryBlindness"; [Dependency] private readonly BlindableSystem _blindableSystem = default!; diff --git a/Content.Shared/Fluids/Components/DrainComponent.cs b/Content.Shared/Fluids/Components/DrainComponent.cs index 305ed00b14..a7d7bbb3ad 100644 --- a/Content.Shared/Fluids/Components/DrainComponent.cs +++ b/Content.Shared/Fluids/Components/DrainComponent.cs @@ -1,6 +1,7 @@ using Content.Shared.Chemistry.Components; using Content.Shared.Tag; using Robust.Shared.Audio; +using Robust.Shared.Prototypes; namespace Content.Shared.Fluids.Components; @@ -17,8 +18,7 @@ public sealed partial class DrainComponent : Component { public const string SolutionName = "drainBuffer"; - [ValidatePrototypeId] - public const string PlungerTag = "Plunger"; + public static readonly ProtoId PlungerTag = "Plunger"; [ViewVariables] public Entity? Solution = null; diff --git a/Content.Shared/GameTicking/SharedGameTicker.cs b/Content.Shared/GameTicking/SharedGameTicker.cs index 050d4826cb..6b8bc8685b 100644 --- a/Content.Shared/GameTicking/SharedGameTicker.cs +++ b/Content.Shared/GameTicking/SharedGameTicker.cs @@ -18,8 +18,7 @@ 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] - public const string FallbackOverflowJob = "Passenger"; + public static readonly ProtoId FallbackOverflowJob = "Passenger"; public const string FallbackOverflowJobName = "job-name-passenger"; diff --git a/Content.Shared/Gravity/SharedGravitySystem.cs b/Content.Shared/Gravity/SharedGravitySystem.cs index 3ff9792e86..e20771d603 100644 --- a/Content.Shared/Gravity/SharedGravitySystem.cs +++ b/Content.Shared/Gravity/SharedGravitySystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Movement.Components; using Robust.Shared.GameStates; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; +using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Timing; @@ -14,8 +15,7 @@ namespace Content.Shared.Gravity [Dependency] protected readonly IGameTiming Timing = default!; [Dependency] private readonly AlertsSystem _alerts = default!; - [ValidatePrototypeId] - public const string WeightlessAlert = "Weightless"; + public static readonly ProtoId WeightlessAlert = "Weightless"; private EntityQuery _gravityQuery; diff --git a/Content.Shared/Humanoid/HairStyles.cs b/Content.Shared/Humanoid/HairStyles.cs index cb4befd85a..543a0de817 100644 --- a/Content.Shared/Humanoid/HairStyles.cs +++ b/Content.Shared/Humanoid/HairStyles.cs @@ -1,14 +1,13 @@ using Content.Shared.Humanoid.Markings; +using Robust.Shared.Prototypes; namespace Content.Shared.Humanoid { public static class HairStyles { - [ValidatePrototypeId] - public const string DefaultHairStyle = "HairBald"; + public static readonly ProtoId DefaultHairStyle = "HairBald"; - [ValidatePrototypeId] - public const string DefaultFacialHairStyle = "FacialHairShaved"; + public static readonly ProtoId DefaultFacialHairStyle = "FacialHairShaved"; public static readonly IReadOnlyList RealisticHairColors = new List { diff --git a/Content.Shared/Humanoid/HumanoidCharacterAppearance.cs b/Content.Shared/Humanoid/HumanoidCharacterAppearance.cs index 7d4a17b337..66f9108365 100644 --- a/Content.Shared/Humanoid/HumanoidCharacterAppearance.cs +++ b/Content.Shared/Humanoid/HumanoidCharacterAppearance.cs @@ -131,10 +131,10 @@ public sealed partial class HumanoidCharacterAppearance : ICharacterAppearance, var newHairStyle = hairStyles.Count > 0 ? random.Pick(hairStyles) - : HairStyles.DefaultHairStyle; + : HairStyles.DefaultHairStyle.Id; var newFacialHairStyle = facialHairStyles.Count == 0 || sex == Sex.Female - ? HairStyles.DefaultFacialHairStyle + ? HairStyles.DefaultFacialHairStyle.Id : random.Pick(facialHairStyles); var newHairColor = random.Pick(HairStyles.RealisticHairColors); diff --git a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs index 2669089650..3d3af84a30 100644 --- a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs +++ b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs @@ -41,8 +41,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem [Dependency] private readonly GrammarSystem _grammarSystem = default!; [Dependency] private readonly SharedIdentitySystem _identity = default!; - [ValidatePrototypeId] - public const string DefaultSpecies = "Human"; + public static readonly ProtoId DefaultSpecies = "Human"; public override void Initialize() { diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index de24a64a1c..3ed068070a 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -15,6 +15,7 @@ using Content.Shared.Strip.Components; using Content.Shared.Whitelist; using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; +using Robust.Shared.Prototypes; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -35,8 +36,7 @@ public abstract partial class InventorySystem [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; [Dependency] private readonly SharedStrippableSystem _strippable = default!; - [ValidatePrototypeId] - private const string PocketableItemSize = "Small"; + private static readonly ProtoId PocketableItemSize = "Small"; private void InitializeEquip() { diff --git a/Content.Shared/Inventory/VirtualItem/SharedVirtualItemSystem.cs b/Content.Shared/Inventory/VirtualItem/SharedVirtualItemSystem.cs index d76a4a3415..8842223afc 100644 --- a/Content.Shared/Inventory/VirtualItem/SharedVirtualItemSystem.cs +++ b/Content.Shared/Inventory/VirtualItem/SharedVirtualItemSystem.cs @@ -30,8 +30,7 @@ public abstract class SharedVirtualItemSystem : EntitySystem [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; - [ValidatePrototypeId] - private const string VirtualItem = "VirtualItem"; + private static readonly EntProtoId VirtualItem = "VirtualItem"; public override void Initialize() { diff --git a/Content.Shared/Maps/ContentTileDefinition.cs b/Content.Shared/Maps/ContentTileDefinition.cs index 9fc4bee481..64975b5616 100644 --- a/Content.Shared/Maps/ContentTileDefinition.cs +++ b/Content.Shared/Maps/ContentTileDefinition.cs @@ -15,8 +15,7 @@ namespace Content.Shared.Maps [Prototype("tile")] public sealed partial class ContentTileDefinition : IPrototype, IInheritingPrototype, ITileDefinition { - [ValidatePrototypeId] - public const string PryingToolQuality = "Prying"; + public static readonly ProtoId PryingToolQuality = "Prying"; public const string SpaceID = "Space"; diff --git a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs index be8f19f98c..bd869c6415 100644 --- a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs @@ -25,14 +25,9 @@ public sealed class HungerSystem : EntitySystem [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!; [Dependency] private readonly SharedJetpackSystem _jetpack = default!; - [ValidatePrototypeId] - private const string HungerIconOverfedId = "HungerIconOverfed"; - - [ValidatePrototypeId] - private const string HungerIconPeckishId = "HungerIconPeckish"; - - [ValidatePrototypeId] - private const string HungerIconStarvingId = "HungerIconStarving"; + private static readonly ProtoId HungerIconOverfedId = "HungerIconOverfed"; + private static readonly ProtoId HungerIconPeckishId = "HungerIconPeckish"; + private static readonly ProtoId HungerIconStarvingId = "HungerIconStarving"; public override void Initialize() { diff --git a/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs b/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs index 052e73cd1b..808337639a 100644 --- a/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs @@ -23,14 +23,9 @@ public sealed class ThirstSystem : EntitySystem [Dependency] private readonly MovementSpeedModifierSystem _movement = default!; [Dependency] private readonly SharedJetpackSystem _jetpack = default!; - [ValidatePrototypeId] - private const string ThirstIconOverhydratedId = "ThirstIconOverhydrated"; - - [ValidatePrototypeId] - private const string ThirstIconThirstyId = "ThirstIconThirsty"; - - [ValidatePrototypeId] - private const string ThirstIconParchedId = "ThirstIconParched"; + private static readonly ProtoId ThirstIconOverhydratedId = "ThirstIconOverhydrated"; + private static readonly ProtoId ThirstIconThirstyId = "ThirstIconThirsty"; + private static readonly ProtoId ThirstIconParchedId = "ThirstIconParched"; public override void Initialize() { diff --git a/Content.Shared/Players/PlayTimeTracking/PlayTimeTrackingShared.cs b/Content.Shared/Players/PlayTimeTracking/PlayTimeTrackingShared.cs index ccaf9c17dd..d02a22171a 100644 --- a/Content.Shared/Players/PlayTimeTracking/PlayTimeTrackingShared.cs +++ b/Content.Shared/Players/PlayTimeTracking/PlayTimeTrackingShared.cs @@ -1,4 +1,5 @@ using Content.Shared.Dataset; +using Robust.Shared.Prototypes; namespace Content.Shared.Players.PlayTimeTracking; @@ -7,12 +8,10 @@ public static class PlayTimeTrackingShared /// /// The prototype ID of the play time tracker that represents overall playtime, i.e. not tied to any one role. /// - [ValidatePrototypeId] - public const string TrackerOverall = "Overall"; + public static readonly ProtoId TrackerOverall = "Overall"; /// /// The prototype ID of the play time tracker that represents admin time, when a player is in game as admin. /// - [ValidatePrototypeId] - public const string TrackerAdmin = "Admin"; + public static readonly ProtoId TrackerAdmin = "Admin"; } diff --git a/Content.Shared/Preferences/HumanoidCharacterProfile.cs b/Content.Shared/Preferences/HumanoidCharacterProfile.cs index 616b213194..845e359564 100644 --- a/Content.Shared/Preferences/HumanoidCharacterProfile.cs +++ b/Content.Shared/Preferences/HumanoidCharacterProfile.cs @@ -198,8 +198,10 @@ namespace Content.Shared.Preferences /// /// The species to use in this default profile. The default species is . /// Humanoid character profile with default settings. - public static HumanoidCharacterProfile DefaultWithSpecies(string species = SharedHumanoidAppearanceSystem.DefaultSpecies) + public static HumanoidCharacterProfile DefaultWithSpecies(string? species = null) { + species ??= SharedHumanoidAppearanceSystem.DefaultSpecies; + return new() { Species = species, @@ -221,8 +223,10 @@ namespace Content.Shared.Preferences return RandomWithSpecies(species); } - public static HumanoidCharacterProfile RandomWithSpecies(string species = SharedHumanoidAppearanceSystem.DefaultSpecies) + public static HumanoidCharacterProfile RandomWithSpecies(string? species = null) { + species ??= SharedHumanoidAppearanceSystem.DefaultSpecies; + var prototypeManager = IoCManager.Resolve(); var random = IoCManager.Resolve(); diff --git a/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs b/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs index b4b383d800..0b091d3a61 100644 --- a/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs +++ b/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs @@ -33,7 +33,7 @@ public abstract partial class SharedFultonSystem : EntitySystem [Dependency] protected readonly SharedTransformSystem TransformSystem = default!; [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; - [ValidatePrototypeId] public const string EffectProto = "FultonEffect"; + public static readonly EntProtoId EffectProto = "FultonEffect"; protected static readonly Vector2 EffectOffset = Vector2.Zero; public override void Initialize() diff --git a/Content.Shared/Salvage/SharedSalvageSystem.cs b/Content.Shared/Salvage/SharedSalvageSystem.cs index 12d0a26449..6e596449b4 100644 --- a/Content.Shared/Salvage/SharedSalvageSystem.cs +++ b/Content.Shared/Salvage/SharedSalvageSystem.cs @@ -23,8 +23,7 @@ public abstract partial class SharedSalvageSystem : EntitySystem /// /// Main loot table for salvage expeditions. /// - [ValidatePrototypeId] - public const string ExpeditionsLootProto = "SalvageLoot"; + public static readonly ProtoId ExpeditionsLootProto = "SalvageLoot"; public string GetFTLName(LocalizedDatasetPrototype dataset, int seed) { diff --git a/Content.Shared/Silicons/Borgs/BorgTypePrototype.cs b/Content.Shared/Silicons/Borgs/BorgTypePrototype.cs index 2f47dd4cea..a45e2aa1d1 100644 --- a/Content.Shared/Silicons/Borgs/BorgTypePrototype.cs +++ b/Content.Shared/Silicons/Borgs/BorgTypePrototype.cs @@ -15,7 +15,6 @@ namespace Content.Shared.Silicons.Borgs; [Prototype] public sealed partial class BorgTypePrototype : IPrototype { - [ValidatePrototypeId] private static readonly ProtoId DefaultFootsteps = new("FootstepBorg"); [IdDataField] diff --git a/Content.Shared/Silicons/Borgs/SharedBorgSwitchableTypeSystem.cs b/Content.Shared/Silicons/Borgs/SharedBorgSwitchableTypeSystem.cs index 55287e4d23..914470e3c9 100644 --- a/Content.Shared/Silicons/Borgs/SharedBorgSwitchableTypeSystem.cs +++ b/Content.Shared/Silicons/Borgs/SharedBorgSwitchableTypeSystem.cs @@ -21,8 +21,7 @@ public abstract class SharedBorgSwitchableTypeSystem : EntitySystem [Dependency] protected readonly IPrototypeManager Prototypes = default!; [Dependency] private readonly InteractionPopupSystem _interactionPopup = default!; - [ValidatePrototypeId] - public const string ActionId = "ActionSelectBorgType"; + public static readonly EntProtoId ActionId = "ActionSelectBorgType"; public override void Initialize() { diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs index 1615ab0fa3..72374a8a30 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs @@ -69,7 +69,6 @@ public abstract partial class SharedStationAiSystem : EntitySystem private EntityQuery _broadphaseQuery; private EntityQuery _gridQuery; - [ValidatePrototypeId] private static readonly EntProtoId DefaultAi = "StationAiBrain"; private const float MaxVisionMultiplier = 5f; diff --git a/Content.Shared/Speech/EntitySystems/SharedStutteringSystem.cs b/Content.Shared/Speech/EntitySystems/SharedStutteringSystem.cs index 1a5a4daeec..05358a04bb 100644 --- a/Content.Shared/Speech/EntitySystems/SharedStutteringSystem.cs +++ b/Content.Shared/Speech/EntitySystems/SharedStutteringSystem.cs @@ -1,11 +1,11 @@ using Content.Shared.StatusEffect; +using Robust.Shared.Prototypes; namespace Content.Shared.Speech.EntitySystems; public abstract class SharedStutteringSystem : EntitySystem { - [ValidatePrototypeId] - public const string StutterKey = "Stutter"; + public static readonly ProtoId StutterKey = "Stutter"; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; diff --git a/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs b/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs index 48a941d598..1b58381675 100644 --- a/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs +++ b/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs @@ -28,8 +28,7 @@ public abstract class SharedSprayPainterSystem : EntitySystem public List Styles { get; private set; } = new(); public List Groups { get; private set; } = new(); - [ValidatePrototypeId] - private const string Departments = "Departments"; + private static readonly ProtoId Departments = "Departments"; public override void Initialize() { @@ -180,7 +179,7 @@ public abstract class SharedSprayPainterSystem : EntitySystem } // get their department ids too for the final style list - var departments = Proto.Index(Departments); + var departments = Proto.Index(Departments); Styles.Capacity = names.Count; foreach (var name in names) { diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index adba19e047..f3c9055910 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -83,8 +83,7 @@ public abstract class SharedStorageSystem : EntitySystem /// public bool NestedStorage = true; - [ValidatePrototypeId] - public const string DefaultStorageMaxItemSize = "Normal"; + public static readonly ProtoId DefaultStorageMaxItemSize = "Normal"; public const float AreaInsertDelayPerItem = 0.075f; private static AudioParams _audioParams = AudioParams.Default @@ -254,7 +253,7 @@ public abstract class SharedStorageSystem : EntitySystem private void UpdatePrototypeCache() { - _defaultStorageMaxItemSize = _prototype.Index(DefaultStorageMaxItemSize); + _defaultStorageMaxItemSize = _prototype.Index(DefaultStorageMaxItemSize); _sortedSizes.Clear(); _sortedSizes.AddRange(_prototype.EnumeratePrototypes()); _sortedSizes.Sort();