]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Replace `ValidatePrototypeId` uses with `ProtoId` or `EntProtoId` (#38814)
authorTayrtahn <tayrtahn@gmail.com>
Mon, 7 Jul 2025 19:57:05 +0000 (15:57 -0400)
committerGitHub <noreply@github.com>
Mon, 7 Jul 2025 19:57:05 +0000 (21:57 +0200)
* The easy ones

* For certain values of easy

* Easy test

* Hair

* Fix sandbox violations

* Sort usings

77 files changed:
Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs
Content.Client/Construction/UI/FlatpackCreatorMenu.xaml.cs
Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs
Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs
Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs
Content.Client/Overlays/ShowJobIconsSystem.cs
Content.Client/Parallax/ParallaxSystem.cs
Content.Client/Power/Generation/Teg/TegSystem.cs
Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs
Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs
Content.Client/UserInterface/RichText/MonoTag.cs
Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Content.Client/UserInterface/Systems/Info/InfoUIController.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.IntegrationTests/Tests/Linter/StaticFieldValidationTest.cs
Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Content.Server/Anomaly/AnomalySystem.cs
Content.Server/Body/Commands/AddHandCommand.cs
Content.Server/Cargo/Systems/CargoSystem.Bounty.cs
Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs
Content.Server/Chat/Systems/ChatSystem.cs
Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs
Content.Server/Construction/Commands/TileWallsCommand.cs
Content.Server/Electrocution/ElectrocuteCommand.cs
Content.Server/Electrocution/ElectrocutionSystem.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.cs
Content.Server/Fluids/EntitySystems/PuddleSystem.cs
Content.Server/GameTicking/GameTicker.Spawning.cs
Content.Server/GameTicking/GameTicker.cs
Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Content.Server/Mapping/MappingCommand.cs
Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs
Content.Server/Medical/VomitSystem.cs
Content.Server/Procedural/DungeonSystem.cs
Content.Server/Revenant/EntitySystems/RevenantSystem.cs
Content.Server/Salvage/SalvageSystem.Magnet.cs
Content.Server/Salvage/SpawnSalvageMissionJob.cs
Content.Server/Shuttles/Commands/FTLDiskCommand.cs
Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
Content.Server/Silicons/Borgs/BorgSystem.cs
Content.Server/Silicons/Laws/IonStormSystem.cs
Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs
Content.Server/Speech/EntitySystems/SlurredSystem.cs
Content.Server/Spreader/KudzuSystem.cs
Content.Server/StoreDiscount/Systems/StoreDiscountSystem.cs
Content.Server/Temperature/Systems/TemperatureSystem.cs
Content.Server/Traitor/Uplink/UplinkSystem.cs
Content.Server/Xenoarchaeology/Artifact/XenoArtifactCommands.cs
Content.Shared/Chat/SharedChatSystem.cs
Content.Shared/Chat/TypingIndicator/SharedTypingIndicatorSystem.cs
Content.Shared/Doors/Systems/SharedDoorSystem.cs
Content.Shared/Drunk/DrunkSystem.cs
Content.Shared/Eye/Blinding/Systems/TemporaryBlindnessSystem.cs
Content.Shared/Fluids/Components/DrainComponent.cs
Content.Shared/GameTicking/SharedGameTicker.cs
Content.Shared/Gravity/SharedGravitySystem.cs
Content.Shared/Humanoid/HairStyles.cs
Content.Shared/Humanoid/HumanoidCharacterAppearance.cs
Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs
Content.Shared/Inventory/InventorySystem.Equip.cs
Content.Shared/Inventory/VirtualItem/SharedVirtualItemSystem.cs
Content.Shared/Maps/ContentTileDefinition.cs
Content.Shared/Nutrition/EntitySystems/HungerSystem.cs
Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs
Content.Shared/Players/PlayTimeTracking/PlayTimeTrackingShared.cs
Content.Shared/Preferences/HumanoidCharacterProfile.cs
Content.Shared/Salvage/Fulton/SharedFultonSystem.cs
Content.Shared/Salvage/SharedSalvageSystem.cs
Content.Shared/Silicons/Borgs/BorgTypePrototype.cs
Content.Shared/Silicons/Borgs/SharedBorgSwitchableTypeSystem.cs
Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs
Content.Shared/Speech/EntitySystems/SharedStutteringSystem.cs
Content.Shared/SprayPainter/SharedSprayPainterSystem.cs
Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs

index 374b00aa6e3cb852fb36dfbe474e3ab9187543bf..3392545be8a6477d4dfbe541c7944cd3ae59fa98 100644 (file)
@@ -18,14 +18,10 @@ public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem
 {
     [Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
 
-    [ValidatePrototypeId<MixingCategoryPrototype>]
-    private const string DefaultMixingCategory = "DummyMix";
-    [ValidatePrototypeId<MixingCategoryPrototype>]
-    private const string DefaultGrindCategory = "DummyGrind";
-    [ValidatePrototypeId<MixingCategoryPrototype>]
-    private const string DefaultJuiceCategory = "DummyJuice";
-    [ValidatePrototypeId<MixingCategoryPrototype>]
-    private const string DefaultCondenseCategory = "DummyCondense";
+    private static readonly ProtoId<MixingCategoryPrototype> DefaultMixingCategory = "DummyMix";
+    private static readonly ProtoId<MixingCategoryPrototype> DefaultGrindCategory = "DummyGrind";
+    private static readonly ProtoId<MixingCategoryPrototype> DefaultJuiceCategory = "DummyJuice";
+    private static readonly ProtoId<MixingCategoryPrototype> DefaultCondenseCategory = "DummyCondense";
 
     private readonly Dictionary<string, List<ReagentSourceData>> _reagentSources = new();
 
index 81410dc7e6df5302e91bdc089a5d2b6116615bf1..8ee8df48fd305afeb6928e23566fb61c2e581bbf 100644 (file)
@@ -27,8 +27,7 @@ public sealed partial class FlatpackCreatorMenu : FancyWindow
 
     private EntityUid _owner;
 
-    [ValidatePrototypeId<EntityPrototype>]
-    public const string NoBoardEffectId = "FlatpackerNoBoardEffect";
+    public static readonly EntProtoId NoBoardEffectId = "FlatpackerNoBoardEffect";
 
     private EntityUid? _currentBoard = EntityUid.Invalid;
 
index 5eaed770414e85dfa84f8eeaf448e656169d45d0..33b4fbc335d8fa4232d2aaa2b0780816472e65d2 100644 (file)
@@ -33,8 +33,7 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow
 
     public readonly EntityUid Console;
 
-    [ValidatePrototypeId<LocalizedDatasetPrototype>]
-    private const string ReasonPlaceholders = "CriminalRecordsWantedReasonPlaceholders";
+    private static readonly ProtoId<LocalizedDatasetPrototype> ReasonPlaceholders = "CriminalRecordsWantedReasonPlaceholders";
 
     public Action<uint?>? OnKeySelected;
     public Action<StationRecordFilterType, string>? 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<LocalizedDatasetPrototype>(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);
index 29ed1244226f62ad627b2d203ff47e80da70adf9..66d3f693b8440026b5c149637454180983bb4967 100644 (file)
@@ -21,8 +21,7 @@ namespace Content.Client.Guidebook.Controls;
 [UsedImplicitly, GenerateTypedNameReferences]
 public sealed partial class GuideReagentReaction : BoxContainer, ISearchableControl
 {
-    [ValidatePrototypeId<MixingCategoryPrototype>]
-    private const string DefaultMixingCategory = "DummyMix";
+    private static readonly ProtoId<MixingCategoryPrototype> DefaultMixingCategory = "DummyMix";
 
     private readonly IPrototypeManager _protoMan;
 
@@ -55,7 +54,7 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont
         }
         else
         {
-            mixingCategories.Add(protoMan.Index<MixingCategoryPrototype>(DefaultMixingCategory));
+            mixingCategories.Add(protoMan.Index(DefaultMixingCategory));
         }
         SetMixingCategory(mixingCategories, prototype, sysMan);
     }
index f22d1416ca53de159b91aca1184a56a87d5efb79..12eb7ffc238981d300bc9b04f764aaf990553462 100644 (file)
@@ -103,8 +103,7 @@ namespace Content.Client.Lobby.UI
 
         private bool _isDirty;
 
-        [ValidatePrototypeId<GuideEntryPrototype>]
-        private const string DefaultSpeciesGuidebook = "Species";
+        private static readonly ProtoId<GuideEntryPrototype> DefaultSpeciesGuidebook = "Species";
 
         public event Action<List<ProtoId<GuideEntryPrototype>>>? OnOpenGuidebook;
 
@@ -809,9 +808,9 @@ namespace Content.Client.Lobby.UI
             var species = Profile?.Species ?? SharedHumanoidAppearanceSystem.DefaultSpecies;
             var page = DefaultSpeciesGuidebook;
             if (_prototypeManager.HasIndex<GuideEntryPrototype>(species))
-                page = species;
+                page = new ProtoId<GuideEntryPrototype>(species.Id); // Gross. See above todo comment.
 
-            if (_prototypeManager.TryIndex<GuideEntryPrototype>(DefaultSpeciesGuidebook, out var guideRoot))
+            if (_prototypeManager.TryIndex(DefaultSpeciesGuidebook, out var guideRoot))
             {
                 var dict = new Dictionary<ProtoId<GuideEntryPrototype>, 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<Marking>(),
-                _ => new() { new(Profile.Appearance.HairStyleId, new List<Color>() { Profile.Appearance.HairColor }) },
-            };
+            var hairMarking = Profile.Appearance.HairStyleId == HairStyles.DefaultHairStyle
+                ? new List<Marking>()
+                : new() { new(Profile.Appearance.HairStyleId, new List<Color>() { Profile.Appearance.HairColor }) };
 
-            var facialHairMarking = Profile.Appearance.FacialHairStyleId switch
-            {
-                HairStyles.DefaultFacialHairStyle => new List<Marking>(),
-                _ => new() { new(Profile.Appearance.FacialHairStyleId, new List<Color>() { Profile.Appearance.FacialHairColor }) },
-            };
+            var facialHairMarking = Profile.Appearance.FacialHairStyleId == HairStyles.DefaultFacialHairStyle
+                ? new List<Marking>()
+                : new() { new(Profile.Appearance.FacialHairStyleId, new List<Color>() { Profile.Appearance.FacialHairColor }) };
 
             HairStylePicker.UpdateData(
                 hairMarking,
index 8f519e61ac1c6dfb26f0eea1d6d52041687a03b5..9828222447996200e2b0897ae424e0da93ebedeb 100644 (file)
@@ -23,8 +23,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
     [Dependency] private readonly ActionsSystem _actions = default!;
     [Dependency] private readonly IInputManager _inputManager = default!;
 
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string Action = "ActionClearNetworkLinkOverlays";
+    private static readonly EntProtoId Action = "ActionClearNetworkLinkOverlays";
 
     public override void Initialize()
     {
index e5ba9b813f02caa7153b851abdcc79591670c324..d0d14449f66a9637e14dd786224b93ea5c0966b3 100644 (file)
@@ -13,8 +13,7 @@ public sealed class ShowJobIconsSystem : EquipmentHudSystem<ShowJobIconsComponen
     [Dependency] private readonly IPrototypeManager _prototype = default!;
     [Dependency] private readonly AccessReaderSystem _accessReader = default!;
 
-    [ValidatePrototypeId<JobIconPrototype>]
-    private const string JobIconForNoId = "JobIconNoId";
+    private static readonly ProtoId<JobIconPrototype> JobIconForNoId = "JobIconNoId";
 
     public override void Initialize()
     {
@@ -52,7 +51,7 @@ public sealed class ShowJobIconsSystem : EquipmentHudSystem<ShowJobIconsComponen
             }
         }
 
-        if (_prototype.TryIndex<JobIconPrototype>(iconId, out var iconPrototype))
+        if (_prototype.TryIndex(iconId, out var iconPrototype))
             ev.StatusIcons.Add(iconPrototype);
         else
             Log.Error($"Invalid job icon prototype: {iconPrototype}");
index 465bc9cef4edde25826fca4268e6eb0d159c884f..7fed53782a1a04535a4f99061ec2f31856317ca3 100644 (file)
@@ -14,8 +14,7 @@ public sealed class ParallaxSystem : SharedParallaxSystem
     [Dependency] private readonly IParallaxManager _parallax = default!;
     [Dependency] private readonly SharedMapSystem _map = default!;
 
-    [ValidatePrototypeId<ParallaxPrototype>]
-    private const string Fallback = "Default";
+    private static readonly ProtoId<ParallaxPrototype> Fallback = "Default";
 
     public const int ParallaxZIndex = 0;
 
index 92b5062b6d20f2bec87d892b5741e746c0593ce3..0ae1b5e49643b1f662bdfc41be5c90d43a810c5c 100644 (file)
@@ -15,8 +15,7 @@ namespace Content.Client.Power.Generation.Teg;
 /// <seealso cref="TegCirculatorComponent"/>
 public sealed class TegSystem : EntitySystem
 {
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string ArrowPrototype = "TegCirculatorArrow";
+    private static readonly EntProtoId ArrowPrototype = "TegCirculatorArrow";
 
     public override void Initialize()
     {
index e1fbd376b54ebc59a14440b6ce279e2c1671ff05..be59b07b657bc718626611162d8fcc70b75b42bc 100644 (file)
@@ -25,7 +25,6 @@ public sealed partial class BorgSelectTypeMenu : FancyWindow
 
     public event Action<ProtoId<BorgTypePrototype>>? ConfirmedBorgType;
 
-    [ValidatePrototypeId<GuideEntryPrototype>]
     private static readonly List<ProtoId<GuideEntryPrototype>> GuidebookEntries = new() { "Cyborgs", "Robotics" };
 
     public BorgSelectTypeMenu()
index bb0dba2f57d94309fddcb9b5462359a1313324a6..245ea194f04dddcd7bd0ec38f591876cfa62f378 100644 (file)
@@ -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;
             };
index aee41c324af1bb29f1e96052ed881aca66bffbbd..d97997dc83ebadbae2cc6c54a318382674c4b95a 100644 (file)
@@ -12,7 +12,7 @@ namespace Content.Client.UserInterface.RichText;
 /// </summary>
 public sealed class MonoTag : IMarkupTag
 {
-    [ValidatePrototypeId<FontPrototype>] public const string MonoFont = "Monospace";
+    public static readonly ProtoId<FontPrototype> MonoFont = "Monospace";
 
     [Dependency] private readonly IResourceCache _resourceCache = default!;
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
index 13c6ff4a2ab9a279a4178ce804a6e637185364fb..e3244298596b26afe5fff8d6ecceeda643457c0c 100644 (file)
@@ -67,8 +67,7 @@ public sealed partial class ChatUIController : UIController
     [UISystemDependency] private readonly MindSystem? _mindSystem = default!;
     [UISystemDependency] private readonly RoleCodewordSystem? _roleCodewordSystem = default!;
 
-    [ValidatePrototypeId<ColorPalettePrototype>]
-    private const string ChatNamePalette = "ChatNames";
+    private static readonly ProtoId<ColorPalettePrototype> 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<ColorPalettePrototype>(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++)
         {
index 9f3461eaddc161241f959272d1ba4b0467825b77..692ee26774b350c5701f6e737a547f4026a21697 100644 (file)
@@ -19,8 +19,7 @@ public sealed class InfoUIController : UIController, IOnStateExited<GameplayStat
     private RulesPopup? _rulesPopup;
     private RulesAndInfoWindow? _infoWindow;
 
-    [ValidatePrototypeId<GuideEntryPrototype>]
-    private const string DefaultRuleset = "DefaultRuleset";
+    private static readonly ProtoId<GuideEntryPrototype> DefaultRuleset = "DefaultRuleset";
 
     public ProtoId<GuideEntryPrototype> RulesEntryId = DefaultRuleset;
 
@@ -92,7 +91,7 @@ public sealed class InfoUIController : UIController, IOnStateExited<GameplayStat
     {
         if (!_prototype.TryIndex(RulesEntryId, out var guideEntryPrototype))
         {
-            guideEntryPrototype = _prototype.Index<GuideEntryPrototype>(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;
         }
index dd26effb3328a198e1b1e625bf953a58c9dd26bb..6abebda6ee4e8dee926cc61d0c7ab5437c3f8eb2 100644 (file)
@@ -39,8 +39,7 @@ public sealed partial class GunSystem : SharedGunSystem
     [Dependency] private readonly SharedTransformSystem _xform = default!;
     [Dependency] private readonly SpriteSystem _sprite = default!;
 
-    [ValidatePrototypeId<EntityPrototype>]
-    public const string HitscanProto = "HitscanEffect";
+    public static readonly EntProtoId HitscanProto = "HitscanEffect";
 
     public bool SpreadOverlay
     {
index 90bf82e8f1035a5603baba5fd35ffbe61346439f..b75b81ab3ca8505841eb9ebc004eb90bfc3d29b5 100644 (file)
@@ -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<TagPrototype>] public static string Tag = "StaticFieldTestTag";
+        public static readonly ProtoId<TagPrototype> Tag = "StaticFieldTestTag";
     }
 
     [Reflect(false)]
     private sealed class StringInvalid
     {
-        [ValidatePrototypeId<TagPrototype>] public static string Tag = string.Empty;
+        public static readonly ProtoId<TagPrototype> Tag = string.Empty;
     }
 
     [Reflect(false)]
     private sealed class StringArrayValid
     {
-        [ValidatePrototypeId<TagPrototype>] public static string[] Tag = ["StaticFieldTestTag", "StaticFieldTestTag"];
+        public static readonly ProtoId<TagPrototype>[] Tag = ["StaticFieldTestTag", "StaticFieldTestTag"];
     }
 
     [Reflect(false)]
     private sealed class StringArrayInvalid
     {
-        [ValidatePrototypeId<TagPrototype>] public static string[] Tag = [string.Empty, "StaticFieldTestTag", string.Empty];
+        public static readonly ProtoId<TagPrototype>[] Tag = [string.Empty, "StaticFieldTestTag", string.Empty];
     }
 
     [Reflect(false)]
index 6c7727ab4e3be94e636e92443f7798fb940a05d7..672ae695bf8a5bc4025822185943a032b9fe62b2 100644 (file)
@@ -22,25 +22,14 @@ public sealed partial class AdminVerbSystem
     [Dependency] private readonly GameTicker _gameTicker = default!;
     [Dependency] private readonly OutfitSystem _outfit = default!;
 
-    [ValidatePrototypeId<EntityPrototype>]
-    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<StartingGearPrototype> PirateGearId = "PirateGear";
 
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string DefaultInitialInfectedRule = "Zombie";
-
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string DefaultNukeOpRule = "LoneOpsSpawn";
-
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string DefaultRevsRule = "Revolutionary";
-
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string DefaultThiefRule = "Thief";
-
-    [ValidatePrototypeId<StartingGearPrototype>]
-    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<Verb> 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<ParadoxCloneRuleComponent>(ruleEnt, out var paradoxCloneRuleComp))
                     return;
index b0de3de8f3e511dafe5297543468d40f3b007158..9ac0ce7c94532b12fdfb3d7cab25e3005fd36842 100644 (file)
@@ -44,8 +44,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem
     public const float MinParticleVariation = 0.8f;
     public const float MaxParticleVariation = 1.2f;
 
-    [ValidatePrototypeId<WeightedRandomPrototype>]
-    const string WeightListProto = "AnomalyBehaviorList";
+    private static readonly ProtoId<WeightedRandomPrototype> WeightListProto = "AnomalyBehaviorList";
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -189,7 +188,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem
     #region Behavior
     private string GetRandomBehavior()
     {
-        var weightList = _prototype.Index<WeightedRandomPrototype>(WeightListProto);
+        var weightList = _prototype.Index(WeightListProto);
         return weightList.Pick(_random);
     }
 
index 3e006c539c778a94409d6f805f666278742ec870..a28b07ef572c4dda7b7cc6f56405876266e97eb8 100644 (file)
@@ -17,8 +17,7 @@ namespace Content.Server.Body.Commands
         [Dependency] private readonly IPrototypeManager _protoManager = default!;
         [Dependency] private readonly IRobustRandom _random = default!;
 
-        [ValidatePrototypeId<EntityPrototype>]
-        public const string DefaultHandPrototype = "LeftHandHuman";
+        private static readonly EntProtoId DefaultHandPrototype = "LeftHandHuman";
 
         public string Command => "addhand";
         public string Description => "Adds a hand to your entity.";
index 456d979959869b1caa30669f28197d10c0947aab..934517eadc8d151137d48aebf8c42a617b9a6994 100644 (file)
@@ -29,8 +29,7 @@ public sealed partial class CargoSystem
     [Dependency] private readonly NameIdentifierSystem _nameIdentifier = default!;
     [Dependency] private readonly EntityWhitelistSystem _whitelistSys = default!;
 
-    [ValidatePrototypeId<NameIdentifierGroupPrototype>]
-    private const string BountyNameIdentifierGroup = "Bounty";
+    private static readonly ProtoId<NameIdentifierGroupPrototype> BountyNameIdentifierGroup = "Bounty";
 
     private EntityQuery<StackComponent> _stackQuery;
     private EntityQuery<ContainerManagerComponent> _containerQuery;
index 5247aafbd518fd5e1f3ebf97ee36eb17387d3ae2..b1b23b2732dcb2f4e36cfd5d8999f5c04dca129e 100644 (file)
@@ -16,8 +16,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";
+    private static readonly EntProtoId CartridgePrototypeName = "CrewManifestCartridge";
 
     /// <summary>
     /// Flag that shows that if crew manifest is allowed to be viewed from 'unsecure' entities,
index 2d6fb3c2754ce58739f0d8750c2e9834596774fb..f21c3f78aa2638376681e30d5bcc80023dc4e57d 100644 (file)
@@ -809,8 +809,7 @@ public sealed partial class ChatSystem : SharedChatSystem
         return message;
     }
 
-    [ValidatePrototypeId<ReplacementAccentPrototype>]
-    public const string ChatSanitize_Accent = "chatsanitize";
+    public static readonly ProtoId<ReplacementAccentPrototype> ChatSanitize_Accent = "chatsanitize";
 
     public string SanitizeMessageReplaceWords(string message)
     {
index 6e2e2a91bcd9822f9a2afa9bcd341a64a355f24b..64350cbda17b24014a912796631df20eb3ac9bcc 100644 (file)
@@ -39,8 +39,7 @@ namespace Content.Server.Chemistry.EntitySystems
         [Dependency] private readonly LabelSystem _labelSystem = default!;
         [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
 
-        [ValidatePrototypeId<EntityPrototype>]
-        private const string PillPrototypeId = "Pill";
+        private static readonly EntProtoId PillPrototypeId = "Pill";
 
         public override void Initialize()
         {
index a27caec423947ca2c17b553b6bb1226a66fab953..ca87795b067fe8065ce00c0f22bfdb5648349e72 100644 (file)
@@ -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} <gridId> | {Command}";
 
-    [ValidatePrototypeId<ContentTileDefinition>]
-    public const string TilePrototypeId = "Plating";
-
-    [ValidatePrototypeId<TagPrototype>]
-    public const string WallTag = "Wall";
-    public const string DiagonalTag = "Diagonal";
+    public static readonly ProtoId<ContentTileDefinition> TilePrototypeId = "Plating";
+    public static readonly ProtoId<TagPrototype> WallTag = "Wall";
+    public static readonly ProtoId<TagPrototype> DiagonalTag = "Diagonal";
 
     public void Execute(IConsoleShell shell, string argStr, string[] args)
     {
index c0d0ecf740772e4286cc513edc70e0a273496470..6bc3977544eaf2a7cece3220d5b2a5df11007c14 100644 (file)
@@ -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<StatusEffectPrototype>]
-    private const string ElectrocutionStatusEffect = "Electrocution";
+    private static readonly ProtoId<StatusEffectPrototype> ElectrocutionStatusEffect = "Electrocution";
 
     public override void Execute(IConsoleShell shell, string argStr, string[] args)
     {
index cd2b69d2ced8b8ab112ae445f3a75e56c90b8a7a..18a4d52ac29c2bb03884c9bd4cc4b411e093332e 100644 (file)
@@ -58,12 +58,8 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
     [Dependency] private readonly MetaDataSystem _metaData = default!;
     [Dependency] private readonly TurfSystem _turf = default!;
 
-    [ValidatePrototypeId<StatusEffectPrototype>]
-    private const string StatusEffectKey = "Electrocution";
-
-    [ValidatePrototypeId<DamageTypePrototype>]
-    private const string DamageType = "Shock";
-
+    private static readonly ProtoId<StatusEffectPrototype> StatusEffectKey = "Electrocution";
+    private static readonly ProtoId<DamageTypePrototype> DamageType = "Shock";
     private static readonly ProtoId<TagPrototype> 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<DamageTypePrototype>(DamageType), dmg), origin: sourceUid);
+                new DamageSpecifier(_prototypeManager.Index(DamageType), dmg), origin: sourceUid);
 
             if (actual != null)
             {
index 0cdc6d6b23d69641675b2b545dab2f487cafef89..c50b1e53faafdda017c29a3f1fe3c7625d461161 100644 (file)
@@ -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.
     /// </remarks>
-    [ValidatePrototypeId<ExplosionPrototype>]
-    public const string DefaultExplosionPrototypeId = "Default";
+    public static readonly ProtoId<ExplosionPrototype> DefaultExplosionPrototypeId = "Default";
 
     public override void Initialize()
     {
         base.Initialize();
 
-        DebugTools.Assert(_prototypeManager.HasIndex<ExplosionPrototype>(DefaultExplosionPrototypeId));
+        DebugTools.Assert(_prototypeManager.HasIndex(DefaultExplosionPrototypeId));
 
         // handled in ExplosionSystem.GridMap.cs
         SubscribeLocalEvent<GridRemovalEvent>(OnGridRemoved);
index ca2a2a64f322c45c1c79c00d4e50634d4a8bc6cd..44bbfe2450bc457efea20fe229c9229ebb985473 100644 (file)
@@ -60,16 +60,11 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
     [Dependency] private readonly SharedTransformSystem _transform = default!;
     [Dependency] private readonly TurfSystem _turf = default!;
 
-    [ValidatePrototypeId<ReagentPrototype>]
-    private const string Blood = "Blood";
+    private static readonly ProtoId<ReagentPrototype> Blood = "Blood";
+    private static readonly ProtoId<ReagentPrototype> Slime = "Slime";
+    private static readonly ProtoId<ReagentPrototype> CopperBlood = "CopperBlood";
 
-    [ValidatePrototypeId<ReagentPrototype>]
-    private const string Slime = "Slime";
-
-    [ValidatePrototypeId<ReagentPrototype>]
-    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)
index c59028e69b3cd21f6e96a6a070f3e21d8b987a49..194f6c4997d7f2019692507277f51da6e94d9651 100644 (file)
@@ -36,11 +36,8 @@ namespace Content.Server.GameTicking
         [Dependency] private readonly SharedJobSystem _jobs = default!;
         [Dependency] private readonly AdminSystem _admin = default!;
 
-        [ValidatePrototypeId<EntityPrototype>]
-        public const string ObserverPrototypeName = "MobObserver";
-
-        [ValidatePrototypeId<EntityPrototype>]
-        public const string AdminObserverPrototypeName = "AdminObserver";
+        public static readonly EntProtoId ObserverPrototypeName = "MobObserver";
+        public static readonly EntProtoId AdminObserverPrototypeName = "AdminObserver";
 
         /// <summary>
         /// How many players have joined the round through normal methods.
index fa8314cd27c58f30dc4723f57dff2bb0debca2cc..55bf51db028aa5fd3c820337eca19c5b51820617 100644 (file)
@@ -93,7 +93,7 @@ namespace Content.Server.GameTicking
             InitializePlayer();
             InitializeLobbyBackground();
             InitializeGamePreset();
-            DebugTools.Assert(_prototypeManager.Index<JobPrototype>(FallbackOverflowJob).Name == FallbackOverflowJobName,
+            DebugTools.Assert(_prototypeManager.Index(FallbackOverflowJob).Name == FallbackOverflowJobName,
                 "Overflow role does not have the correct name!");
             InitializeGameRules();
             InitializeReplays();
index 616a1e48ff04cdab775117456faa7882c9d9d740..f687c9dcc79e8f56566c6c171e26518f97a24e4e 100644 (file)
@@ -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<NukeopsRuleComponent>
     [Dependency] private readonly StoreSystem _store = default!;
     [Dependency] private readonly TagSystem _tag = default!;
 
-    [ValidatePrototypeId<CurrencyPrototype>]
-    private const string TelecrystalCurrencyPrototype = "Telecrystal";
-
-    [ValidatePrototypeId<TagPrototype>]
-    private const string NukeOpsUplinkTagPrototype = "NukeOpsUplink";
+    private static readonly ProtoId<CurrencyPrototype> TelecrystalCurrencyPrototype = "Telecrystal";
+    private static readonly ProtoId<TagPrototype> NukeOpsUplinkTagPrototype = "NukeOpsUplink";
 
 
     public override void Initialize()
@@ -485,7 +483,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
 
         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,
index 07ced93085b43c8bcc9d82637d807e40f358790b..f5c8c4d0d8912e33bb9f9968a7e71f998dea965d 100644 (file)
@@ -70,8 +70,7 @@ namespace Content.Server.Kitchen.EntitySystems
         [Dependency] private readonly IAdminLogManager _adminLogger = default!;
         [Dependency] private readonly SharedSuicideSystem _suicide = default!;
 
-        [ValidatePrototypeId<EntityPrototype>]
-        private const string MalfunctionSpark = "Spark";
+        private static readonly EntProtoId MalfunctionSpark = "Spark";
 
         private static readonly ProtoId<TagPrototype> MetalTag = "Metal";
         private static readonly ProtoId<TagPrototype> PlasticTag = "Plastic";
index 96a21573f6db07318a1bfed0b6be155d586423e9..8081b8e45f9d640a25b72fd05626718b1f198018 100644 (file)
@@ -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<MetaDataComponent>(playerEntity).EntityPrototype?.ID != GameTicker.AdminObserverPrototypeName)
+                (EntityManager.GetComponent<MetaDataComponent>(playerEntity).EntityPrototype is not { } proto || proto != GameTicker.AdminObserverPrototypeName))
             {
                 shell.ExecuteCommand("aghost");
             }
index 42e455a47f5e5e80542c3800ebfefe7e328db70b..e029071574bcbce5227beb1e86ffc9ae4aadee50 100644 (file)
@@ -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<MaterialPrototype>]
-        public const string BiomassPrototype = "Biomass";
+        public static readonly ProtoId<MaterialPrototype> BiomassPrototype = "Biomass";
 
         public override void Update(float frameTime)
         {
index 66cc9bf5f6553b085a30662d728332962915ee54..7b8be07a15f8424a30dee6ca2e2aec98c22cfe94 100644 (file)
@@ -32,8 +32,7 @@ namespace Content.Server.Medical
         [Dependency] private readonly ForensicsSystem _forensics = default!;
         [Dependency] private readonly BloodstreamSystem _bloodstream = default!;
 
-        [ValidatePrototypeId<SoundCollectionPrototype>]
-        private const string VomitCollection = "Vomit";
+        private static readonly ProtoId<SoundCollectionPrototype> VomitCollection = "Vomit";
 
         private readonly SoundSpecifier _vomitSound = new SoundCollectionSpecifier(VomitCollection,
             AudioParams.Default.WithVariation(0.2f).WithVolume(-4f));
index 3a0a7ab2cdb90cef141a13434ee3e571d6877046..aac620acc0921e249c4cf209e229e61482892bcb 100644 (file)
@@ -54,8 +54,7 @@ public sealed partial class DungeonSystem : SharedDungeonSystem
     private readonly JobQueue _dungeonJobQueue = new(DungeonJobTime);
     private readonly Dictionary<DungeonJob.DungeonJob, CancellationTokenSource> _dungeonJobs = new();
 
-    [ValidatePrototypeId<ContentTileDefinition>]
-    public const string FallbackTileId = "FloorSteel";
+    public static readonly ProtoId<ContentTileDefinition> FallbackTileId = "FloorSteel";
 
     public override void Initialize()
     {
index 0501f5afc3ee810971d5c37488c24ba581f42f8a..2d38aee6ea6fc482c5ee64b90092fb1e2f1aa035 100644 (file)
@@ -47,8 +47,7 @@ public sealed partial class RevenantSystem : EntitySystem
     [Dependency] private readonly VisibilitySystem _visibility = default!;
     [Dependency] private readonly TurfSystem _turf = default!;
 
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string RevenantShopId = "ActionRevenantShop";
+    private static readonly EntProtoId RevenantShopId = "ActionRevenantShop";
 
     public override void Initialize()
     {
index 41d4c2e755cd63a0c4de8e1b0edc3c6c537f76ad..ee5cd792c69064578b5a2f45a3b0c1356758ebac 100644 (file)
@@ -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<RadioChannelPrototype>]
-    private const string MagnetChannel = "Supply";
+    private static readonly ProtoId<RadioChannelPrototype> MagnetChannel = "Supply";
 
     private EntityQuery<SalvageMobRestrictionsComponent> _salvMobQuery;
     private EntityQuery<MobStateComponent> _mobStateQuery;
index 8b5e9898addaefdc2320f325bace01e7bb7fe74b..75b22598f9b4ae237bcd501f55eb58581b0c08ea 100644 (file)
@@ -255,7 +255,7 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
             }
         }
 
-        var allLoot = _prototypeManager.Index<SalvageLootPrototype>(SharedSalvageSystem.ExpeditionsLootProto);
+        var allLoot = _prototypeManager.Index(SharedSalvageSystem.ExpeditionsLootProto);
         var lootBudget = difficultyProto.LootBudget;
 
         foreach (var rule in allLoot.LootRules)
index 63d45e23644b38ffc3eaaf916557a8af330bb3eb..5d7c108e5dc81451ffb0e11d783f2392c7df6158 100644 (file)
@@ -25,11 +25,8 @@ public sealed class FTLDiskCommand : LocalizedCommands
 
     public override string Command => "ftldisk";
 
-    [ValidatePrototypeId<EntityPrototype>]
-    public const string CoordinatesDisk = "CoordinatesDisk";
-
-    [ValidatePrototypeId<EntityPrototype>]
-    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)
index 95c6ab5a1ba95be76889064345ed72a841d2740d..e07b522c5ae9180efd40ddc6a360f80f56ba80d9 100644 (file)
@@ -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<AccessLevelPrototype>]
-    private const string EmergencyRepealAllAccess = "EmergencyShuttleRepealAll";
+    private static readonly ProtoId<AccessLevelPrototype> EmergencyRepealAllAccess = "EmergencyShuttleRepealAll";
     private static readonly Color DangerColor = Color.Red;
 
     /// <summary>
index 94e028b402839311a6acf8a3601236f7cc5637c2..9eff1455f9b0bfe29132eeea514730e34dee2e49 100644 (file)
@@ -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<TagPrototype>]
-    private const string DockTag = "DockEmergency";
+    private static readonly ProtoId<TagPrototype> DockTag = "DockEmergency";
 
     public override void Initialize()
     {
index fd40aa881622c658ee725425714453081bd413a2..0cd407000f713f7b3e33240e29bc926bd7bc341a 100644 (file)
@@ -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<JobPrototype>]
-    public const string BorgJobId = "Borg";
+    public static readonly ProtoId<JobPrototype> BorgJobId = "Borg";
 
     /// <inheritdoc/>
     public override void Initialize()
index 7b848a0ea6a7c7ac4ac48654c5c0658d793bd8bb..249813edc15e52ddfe8935ccf2edb2ace2de309b 100644 (file)
@@ -22,42 +22,24 @@ public sealed class IonStormSystem : EntitySystem
     [Dependency] private readonly IRobustRandom _robustRandom = default!;
 
     // funny
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Threats = "IonStormThreats";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Objects = "IonStormObjects";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Crew = "IonStormCrew";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Adjectives = "IonStormAdjectives";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Verbs = "IonStormVerbs";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string NumberBase = "IonStormNumberBase";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string NumberMod = "IonStormNumberMod";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Areas = "IonStormAreas";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Feelings = "IonStormFeelings";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string FeelingsPlural = "IonStormFeelingsPlural";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Musts = "IonStormMusts";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Requires = "IonStormRequires";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Actions = "IonStormActions";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Allergies = "IonStormAllergies";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string AllergySeverities = "IonStormAllergySeverities";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Concepts = "IonStormConcepts";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Drinks = "IonStormDrinks";
-    [ValidatePrototypeId<DatasetPrototype>]
-    private const string Foods = "IonStormFoods";
+    private static readonly ProtoId<DatasetPrototype> Threats = "IonStormThreats";
+    private static readonly ProtoId<DatasetPrototype> Objects = "IonStormObjects";
+    private static readonly ProtoId<DatasetPrototype> Crew = "IonStormCrew";
+    private static readonly ProtoId<DatasetPrototype> Adjectives = "IonStormAdjectives";
+    private static readonly ProtoId<DatasetPrototype> Verbs = "IonStormVerbs";
+    private static readonly ProtoId<DatasetPrototype> NumberBase = "IonStormNumberBase";
+    private static readonly ProtoId<DatasetPrototype> NumberMod = "IonStormNumberMod";
+    private static readonly ProtoId<DatasetPrototype> Areas = "IonStormAreas";
+    private static readonly ProtoId<DatasetPrototype> Feelings = "IonStormFeelings";
+    private static readonly ProtoId<DatasetPrototype> FeelingsPlural = "IonStormFeelingsPlural";
+    private static readonly ProtoId<DatasetPrototype> Musts = "IonStormMusts";
+    private static readonly ProtoId<DatasetPrototype> Requires = "IonStormRequires";
+    private static readonly ProtoId<DatasetPrototype> Actions = "IonStormActions";
+    private static readonly ProtoId<DatasetPrototype> Allergies = "IonStormAllergies";
+    private static readonly ProtoId<DatasetPrototype> AllergySeverities = "IonStormAllergySeverities";
+    private static readonly ProtoId<DatasetPrototype> Concepts = "IonStormConcepts";
+    private static readonly ProtoId<DatasetPrototype> Drinks = "IonStormDrinks";
+    private static readonly ProtoId<DatasetPrototype> Foods = "IonStormFoods";
 
     /// <summary>
     /// Randomly alters the laws of an individual silicon.
index baa4f6f347cad1c44e6811778b6945d4e9d1d157..508f85aac274cab3dbcfc3394c48622b323773ed 100644 (file)
@@ -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<StatusEffectPrototype>]
-    private const string RatvarianKey = "RatvarianLanguage";
+    private static readonly ProtoId<StatusEffectPrototype> RatvarianKey = "RatvarianLanguage";
 
     // This is the word of Ratvar and those who speak it shall abide by His rules:
     /*
index e396cd0b186f2728fd40ed0c6557340e47df3e0e..fbfe72f17f6fbd3142e6171e9e1681e595a364b8 100644 (file)
@@ -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<StatusEffectPrototype>]
-    private const string SlurKey = "SlurredSpeech";
+    private static readonly ProtoId<StatusEffectPrototype> SlurKey = "SlurredSpeech";
 
     public override void Initialize()
     {
index 92e6609fd746f4c1c85da49dd317345985e8b5fd..fbc809c15b7c93708f09c54c3b7602e954c52c9b 100644 (file)
@@ -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<EdgeSpreaderPrototype>]
-    private const string KudzuGroup = "Kudzu";
+    private static readonly ProtoId<EdgeSpreaderPrototype> KudzuGroup = "Kudzu";
 
     /// <inheritdoc/>
     public override void Initialize()
index c993c146948a0f7db4630672f643d6bc198dcc1e..dc72a084990fff4c5166b8af9724bf63e1ea32f6 100644 (file)
@@ -14,8 +14,7 @@ namespace Content.Server.StoreDiscount.Systems;
 /// </summary>
 public sealed class StoreDiscountSystem : EntitySystem
 {
-    [ValidatePrototypeId<StoreCategoryPrototype>]
-    private const string DiscountedStoreCategoryPrototypeKey = "DiscountedItems";
+    private static readonly ProtoId<StoreCategoryPrototype> DiscountedStoreCategoryPrototypeKey = "DiscountedItems";
 
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
index d2f6baf6f9f536e0f3f5385af5c8e4174f581ab3..6290e8231adca55240b03865524bc0eca2707f3c 100644 (file)
@@ -36,8 +36,7 @@ public sealed class TemperatureSystem : EntitySystem
 
     private float _accumulatedFrametime;
 
-    [ValidatePrototypeId<AlertCategoryPrototype>]
-    public const string TemperatureAlertCategory = "Temperature";
+    public static readonly ProtoId<AlertCategoryPrototype> TemperatureAlertCategory = "Temperature";
 
     public override void Initialize()
     {
index f30d2d7b4c6736ae2a6620d272caab6909f3f177..f4a9ca75fda07f55a618a8df6dad2f80df225274 100644 (file)
@@ -22,10 +22,9 @@ public sealed class UplinkSystem : EntitySystem
     [Dependency] private readonly SharedSubdermalImplantSystem _subdermalImplant = default!;
     [Dependency] private readonly SharedMindSystem _mind = default!;
 
-    [ValidatePrototypeId<CurrencyPrototype>]
-    public const string TelecrystalCurrencyPrototype = "Telecrystal";
-    private const string FallbackUplinkImplant = "UplinkImplant";
-    private const string FallbackUplinkCatalog = "UplinkUplinkImplanter";
+    public static readonly ProtoId<CurrencyPrototype> TelecrystalCurrencyPrototype = "Telecrystal";
+    private static readonly EntProtoId FallbackUplinkImplant = "UplinkImplant";
+    private static readonly ProtoId<ListingPrototype> FallbackUplinkCatalog = "UplinkUplinkImplanter";
 
     /// <summary>
     /// Adds an uplink to the target
@@ -89,8 +88,6 @@ public sealed class UplinkSystem : EntitySystem
     /// </summary>
     private bool ImplantUplink(EntityUid user, FixedPoint2 balance, bool giveDiscounts)
     {
-        var implantProto = new string(FallbackUplinkImplant);
-
         if (!_proto.TryIndex<ListingPrototype>(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<StoreComponent>(implant))
             return false;
index 31d079e3ad59a17c09c0213ad3548606c94aa070..7fd7acca4b1993baed65c742c8084a7d39a33576 100644 (file)
@@ -14,8 +14,7 @@ namespace Content.Server.Xenoarchaeology.Artifact;
 [ToolshedCommand, AdminCommand(AdminFlags.Debug)]
 public sealed class XenoArtifactCommand : ToolshedCommand
 {
-    [ValidatePrototypeId<EntityPrototype>]
-    public const string ArtifactPrototype = "BaseXenoArtifact";
+    public static readonly EntProtoId ArtifactPrototype = "BaseXenoArtifact";
 
     /// <summary> List existing artifacts. </summary>
     [CommandImplementation("list")]
index e5f3d4699747897601a6c9f3652ceeeb81e58fb0..967980302d93a620a4d35b3c0120c475f06d7901 100644 (file)
@@ -24,13 +24,10 @@ public abstract class SharedChatSystem : EntitySystem
     public const char WhisperPrefix = ',';
     public const char DefaultChannelKey = 'h';
 
-    [ValidatePrototypeId<RadioChannelPrototype>]
-    public const string CommonChannel = "Common";
+    public static readonly ProtoId<RadioChannelPrototype> CommonChannel = "Common";
 
-    public static string DefaultChannelPrefix = $"{RadioChannelPrefix}{DefaultChannelKey}";
-
-    [ValidatePrototypeId<SpeechVerbPrototype>]
-    public const string DefaultSpeechVerb = "Default";
+    public static readonly string DefaultChannelPrefix = $"{RadioChannelPrefix}{DefaultChannelKey}";
+    public static readonly ProtoId<SpeechVerbPrototype> 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<RadioChannelPrototype>(CommonChannel));
+        DebugTools.Assert(_prototypeManager.HasIndex(CommonChannel));
         SubscribeLocalEvent<PrototypesReloadedEventArgs>(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<SpeechVerbPrototype>(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<SpeechVerbPrototype>(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<SpeechVerbPrototype>(speech.SpeechVerb);
+        return current ?? _prototypeManager.Index(speech.SpeechVerb);
     }
 
     /// <summary>
index bc5c95c8abed1c763bb6ed12d9aee71cf877e995..20f2741f0bc7166a0a80d3049c1cd78dcb1e5712 100644 (file)
@@ -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
     /// <summary>
     ///     Default ID of <see cref="TypingIndicatorPrototype"/>
     /// </summary>
-    [ValidatePrototypeId<TypingIndicatorPrototype>]
-    public const string InitialIndicatorId = "default";
+    public static readonly ProtoId<TypingIndicatorPrototype> InitialIndicatorId = "default";
 
     public override void Initialize()
     {
index a0dba80bd92888ab297092058810cf34fdb6bba4..7914a38334ee58696759fd9a8610ca97d713dc47 100644 (file)
@@ -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<TagPrototype>]
-    public const string DoorBumpTag = "DoorBumpOpener";
+    public static readonly ProtoId<TagPrototype> DoorBumpTag = "DoorBumpOpener";
 
     /// <summary>
     ///     A set of doors that are currently opening, closing, or just queued to open/close after some delay.
index 4f9429b6a6b0ad201a6a7d1575bc478d264ac053..236ce2dcd309066ac8af0059868695b846bf1528 100644 (file)
@@ -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<StatusEffectPrototype>]
-    public const string DrunkKey = "Drunk";
+    public static readonly ProtoId<StatusEffectPrototype> DrunkKey = "Drunk";
 
     [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
     [Dependency] private readonly SharedSlurredSystem _slurredSystem = default!;
index aa3ff9fdc3eee7ea9cdd51ba34b635cdac23f8ac..34680b12efe398d216e45cd69c57ff4d0d74bdee 100644 (file)
@@ -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<StatusEffectPrototype>]
-    public const string BlindingStatusEffect = "TemporaryBlindness";
+    public static readonly ProtoId<StatusEffectPrototype> BlindingStatusEffect = "TemporaryBlindness";
 
     [Dependency] private readonly BlindableSystem _blindableSystem = default!;
 
index 305ed00b140a644799cf2e0cd4e31bf52af7573a..a7d7bbb3ad14b266b7be2e8331493db35b8916f1 100644 (file)
@@ -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<TagPrototype>]
-    public const string PlungerTag = "Plunger";
+    public static readonly ProtoId<TagPrototype> PlungerTag = "Plunger";
 
     [ViewVariables]
     public Entity<SolutionComponent>? Solution = null;
index 050d4826cb4ad65d1bc9376f72757b978f58eb39..6b8bc8685b22a3e86e088309172e7f42dcc27fc8 100644 (file)
@@ -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<JobPrototype>]
-        public const string FallbackOverflowJob = "Passenger";
+        public static readonly ProtoId<JobPrototype> FallbackOverflowJob = "Passenger";
 
         public const string FallbackOverflowJobName = "job-name-passenger";
 
index 3ff9792e86d5b0d106de4994687cf9f8b81b85a6..e20771d6038125b6ab2ea0eba2cdb0c1a101fe09 100644 (file)
@@ -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<AlertPrototype>]
-        public const string WeightlessAlert = "Weightless";
+        public static readonly ProtoId<AlertPrototype> WeightlessAlert = "Weightless";
 
         private EntityQuery<GravityComponent> _gravityQuery;
 
index cb4befd85a7614d1532bd09549bd49be38130d78..543a0de817d08c408da25e9fa1c133444609fb33 100644 (file)
@@ -1,14 +1,13 @@
 using Content.Shared.Humanoid.Markings;
+using Robust.Shared.Prototypes;
 
 namespace Content.Shared.Humanoid
 {
     public static class HairStyles
     {
-        [ValidatePrototypeId<MarkingPrototype>]
-        public const string DefaultHairStyle = "HairBald";
+        public static readonly ProtoId<MarkingPrototype> DefaultHairStyle = "HairBald";
 
-        [ValidatePrototypeId<MarkingPrototype>]
-        public const string DefaultFacialHairStyle = "FacialHairShaved";
+        public static readonly ProtoId<MarkingPrototype> DefaultFacialHairStyle = "FacialHairShaved";
 
         public static readonly IReadOnlyList<Color> RealisticHairColors = new List<Color>
         {
index 7d4a17b337d9dc5aba8be37181371b185bb93ceb..66f910836538f6c5647b29cc283577bc89f4dc7d 100644 (file)
@@ -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);
index 26690896502041ecb22b2f2b45444c62acae6b64..3d3af84a3073f06f28c4c163787a1ace51e238e4 100644 (file)
@@ -41,8 +41,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
     [Dependency] private readonly GrammarSystem _grammarSystem = default!;
     [Dependency] private readonly SharedIdentitySystem _identity = default!;
 
-    [ValidatePrototypeId<SpeciesPrototype>]
-    public const string DefaultSpecies = "Human";
+    public static readonly ProtoId<SpeciesPrototype> DefaultSpecies = "Human";
 
     public override void Initialize()
     {
index de24a64a1c14218592e9dcf74f9b595cc3aa9dad..3ed068070a8c6205b830308c853d0f51a2675d1f 100644 (file)
@@ -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<ItemSizePrototype>]
-    private const string PocketableItemSize = "Small";
+    private static readonly ProtoId<ItemSizePrototype> PocketableItemSize = "Small";
 
     private void InitializeEquip()
     {
index d76a4a3415e6ce538113a66fd34b833ed90c9a08..8842223afccf4d86d95a4bab439dbcaf08fdf621 100644 (file)
@@ -30,8 +30,7 @@ public abstract class SharedVirtualItemSystem : EntitySystem
     [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
 
-    [ValidatePrototypeId<EntityPrototype>]
-    private const string VirtualItem = "VirtualItem";
+    private static readonly EntProtoId VirtualItem = "VirtualItem";
 
     public override void Initialize()
     {
index 9fc4bee4813e5c6d019d3921ab29d3687935e7af..64975b5616f67759a013551b21165bf7b2203c05 100644 (file)
@@ -15,8 +15,7 @@ namespace Content.Shared.Maps
     [Prototype("tile")]
     public sealed partial class ContentTileDefinition : IPrototype, IInheritingPrototype, ITileDefinition
     {
-        [ValidatePrototypeId<ToolQualityPrototype>]
-        public const string PryingToolQuality = "Prying";
+        public static readonly ProtoId<ToolQualityPrototype> PryingToolQuality = "Prying";
 
         public const string SpaceID = "Space";
 
index be8f19f98c01cf992512a1ae8afce2de42df9d32..bd869c64154759f50b44b9961f398dcb1fc119e3 100644 (file)
@@ -25,14 +25,9 @@ public sealed class HungerSystem : EntitySystem
     [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
     [Dependency] private readonly SharedJetpackSystem _jetpack = default!;
 
-    [ValidatePrototypeId<SatiationIconPrototype>]
-    private const string HungerIconOverfedId = "HungerIconOverfed";
-
-    [ValidatePrototypeId<SatiationIconPrototype>]
-    private const string HungerIconPeckishId = "HungerIconPeckish";
-
-    [ValidatePrototypeId<SatiationIconPrototype>]
-    private const string HungerIconStarvingId = "HungerIconStarving";
+    private static readonly ProtoId<SatiationIconPrototype> HungerIconOverfedId = "HungerIconOverfed";
+    private static readonly ProtoId<SatiationIconPrototype> HungerIconPeckishId = "HungerIconPeckish";
+    private static readonly ProtoId<SatiationIconPrototype> HungerIconStarvingId = "HungerIconStarving";
 
     public override void Initialize()
     {
index 052e73cd1b11afabbdf7eb997571dbf60c7630e8..808337639ab406a8c70d308aaa4f495b55b7d98a 100644 (file)
@@ -23,14 +23,9 @@ public sealed class ThirstSystem : EntitySystem
     [Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
     [Dependency] private readonly SharedJetpackSystem _jetpack = default!;
 
-    [ValidatePrototypeId<SatiationIconPrototype>]
-    private const string ThirstIconOverhydratedId = "ThirstIconOverhydrated";
-
-    [ValidatePrototypeId<SatiationIconPrototype>]
-    private const string ThirstIconThirstyId = "ThirstIconThirsty";
-
-    [ValidatePrototypeId<SatiationIconPrototype>]
-    private const string ThirstIconParchedId = "ThirstIconParched";
+    private static readonly ProtoId<SatiationIconPrototype> ThirstIconOverhydratedId = "ThirstIconOverhydrated";
+    private static readonly ProtoId<SatiationIconPrototype> ThirstIconThirstyId = "ThirstIconThirsty";
+    private static readonly ProtoId<SatiationIconPrototype> ThirstIconParchedId = "ThirstIconParched";
 
     public override void Initialize()
     {
index ccaf9c17dd4026d68d35f93f922ae9777c047dde..d02a22171ac576d016be5c447299be5a07ae4149 100644 (file)
@@ -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
     /// <summary>
     /// The prototype ID of the play time tracker that represents overall playtime, i.e. not tied to any one role.
     /// </summary>
-    [ValidatePrototypeId<PlayTimeTrackerPrototype>]
-    public const string TrackerOverall = "Overall";
+    public static readonly ProtoId<PlayTimeTrackerPrototype> TrackerOverall = "Overall";
 
     /// <summary>
     /// The prototype ID of the play time tracker that represents admin time, when a player is in game as admin.
     /// </summary>
-    [ValidatePrototypeId<PlayTimeTrackerPrototype>]
-    public const string TrackerAdmin = "Admin";
+    public static readonly ProtoId<PlayTimeTrackerPrototype> TrackerAdmin = "Admin";
 }
index 616b21319405ccfa241b0450eb1019d3b3c31358..845e359564c179a3d48d2d7f9b67779209643b95 100644 (file)
@@ -198,8 +198,10 @@ namespace Content.Shared.Preferences
         /// </summary>
         /// <param name="species">The species to use in this default profile. The default species is <see cref="SharedHumanoidAppearanceSystem.DefaultSpecies"/>.</param>
         /// <returns>Humanoid character profile with default settings.</returns>
-        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<IPrototypeManager>();
             var random = IoCManager.Resolve<IRobustRandom>();
 
index b4b383d8000357e0dedd3deac77e00aad4eaf06e..0b091d3a61262de4fd7d92740e44b1410624e29c 100644 (file)
@@ -33,7 +33,7 @@ public abstract partial class SharedFultonSystem : EntitySystem
     [Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
     [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
-    [ValidatePrototypeId<EntityPrototype>] public const string EffectProto = "FultonEffect";
+    public static readonly EntProtoId EffectProto = "FultonEffect";
     protected static readonly Vector2 EffectOffset = Vector2.Zero;
 
     public override void Initialize()
index 12d0a26449c35a8f875ea51a40c0acce7d4ddb19..6e596449b483cb068e81b95cb9a28c712f771647 100644 (file)
@@ -23,8 +23,7 @@ public abstract partial class SharedSalvageSystem : EntitySystem
     /// <summary>
     /// Main loot table for salvage expeditions.
     /// </summary>
-    [ValidatePrototypeId<SalvageLootPrototype>]
-    public const string ExpeditionsLootProto = "SalvageLoot";
+    public static readonly ProtoId<SalvageLootPrototype> ExpeditionsLootProto = "SalvageLoot";
 
     public string GetFTLName(LocalizedDatasetPrototype dataset, int seed)
     {
index 2f47dd4ceaf9a51e84b645756e703ce183c10549..a45e2aa1d17517a274a810882c1ae3e04dcf1158 100644 (file)
@@ -15,7 +15,6 @@ namespace Content.Shared.Silicons.Borgs;
 [Prototype]
 public sealed partial class BorgTypePrototype : IPrototype
 {
-    [ValidatePrototypeId<SoundCollectionPrototype>]
     private static readonly ProtoId<SoundCollectionPrototype> DefaultFootsteps = new("FootstepBorg");
 
     [IdDataField]
index 55287e4d2386c764fef8bbff8b08c56e3658e674..914470e3c9ab85557626d4a025c4f5ddfcd99448 100644 (file)
@@ -21,8 +21,7 @@ public abstract class SharedBorgSwitchableTypeSystem : EntitySystem
     [Dependency] protected readonly IPrototypeManager Prototypes = default!;
     [Dependency] private readonly InteractionPopupSystem _interactionPopup = default!;
 
-    [ValidatePrototypeId<EntityPrototype>]
-    public const string ActionId = "ActionSelectBorgType";
+    public static readonly EntProtoId ActionId = "ActionSelectBorgType";
 
     public override void Initialize()
     {
index 1615ab0fa309ccf27dd9a9523fc71c23876f179b..72374a8a30fb33a97605755daa6b3999add1931e 100644 (file)
@@ -69,7 +69,6 @@ public abstract partial class SharedStationAiSystem : EntitySystem
     private EntityQuery<BroadphaseComponent> _broadphaseQuery;
     private EntityQuery<MapGridComponent> _gridQuery;
 
-    [ValidatePrototypeId<EntityPrototype>]
     private static readonly EntProtoId DefaultAi = "StationAiBrain";
 
     private const float MaxVisionMultiplier = 5f;
index 1a5a4daeec4767bb56ee2f7aeedd2bd4700f9a5e..05358a04bbc1f85878fbbb8042fb919f9de00c56 100644 (file)
@@ -1,11 +1,11 @@
 using Content.Shared.StatusEffect;
+using Robust.Shared.Prototypes;
 
 namespace Content.Shared.Speech.EntitySystems;
 
 public abstract class SharedStutteringSystem : EntitySystem
 {
-    [ValidatePrototypeId<StatusEffectPrototype>]
-    public const string StutterKey = "Stutter";
+    public static readonly ProtoId<StatusEffectPrototype> StutterKey = "Stutter";
 
     [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
 
index 48a941d598fd290ea09aea8a582cc12b2071296a..1b5838167511d1d05b180876177dafd3dcd56130 100644 (file)
@@ -28,8 +28,7 @@ public abstract class SharedSprayPainterSystem : EntitySystem
     public List<AirlockStyle> Styles { get; private set; } = new();
     public List<AirlockGroupPrototype> Groups { get; private set; } = new();
 
-    [ValidatePrototypeId<AirlockDepartmentsPrototype>]
-    private const string Departments = "Departments";
+    private static readonly ProtoId<AirlockDepartmentsPrototype> 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<AirlockDepartmentsPrototype>(Departments);
+        var departments = Proto.Index(Departments);
         Styles.Capacity = names.Count;
         foreach (var name in names)
         {
index adba19e0470c464d33554a762093b4ac1efc3e11..f3c90559104e535bcba3f1d39910f07a38ca270e 100644 (file)
@@ -83,8 +83,7 @@ public abstract class SharedStorageSystem : EntitySystem
     /// </summary>
     public bool NestedStorage = true;
 
-    [ValidatePrototypeId<ItemSizePrototype>]
-    public const string DefaultStorageMaxItemSize = "Normal";
+    public static readonly ProtoId<ItemSizePrototype> 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<ItemSizePrototype>(DefaultStorageMaxItemSize);
+        _defaultStorageMaxItemSize = _prototype.Index(DefaultStorageMaxItemSize);
         _sortedSizes.Clear();
         _sortedSizes.AddRange(_prototype.EnumeratePrototypes<ItemSizePrototype>());
         _sortedSizes.Sort();