Replace ValidatePrototypeId uses with ProtoId or EntProtoId (#38814)

* The easy ones

* For certain values of easy

* Easy test

* Hair

* Fix sandbox violations

* Sort usings
This commit is contained in:
Tayrtahn
2025-07-07 15:57:05 -04:00
committed by GitHub
parent 41f737e8f3
commit c565b44965
77 changed files with 187 additions and 297 deletions

View 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();

View 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;

View 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);

View 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);
}

View 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,

View 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()
{

View 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}");

View 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;

View 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()
{

View 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()

View 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;
};

View 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!;

View 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++)
{

View 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;
}

View 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
{

View 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)]

View 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;

View 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);
}

View 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.";

View 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;

View 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,

View 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)
{

View 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()
{

View 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)
{

View 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)
{

View 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)
{

View 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);

View 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)

View 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.

View 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();

View 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()

View 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";

View 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");
}

View 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)
{

View 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));

View 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()
{

View 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()
{

View 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;

View 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)

View 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)

View 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>

View 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()
{

View 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()

View 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.

View 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:
/*

View 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()
{

View 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()

View 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!;

View 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()
{

View 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;

View 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")]

View 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>

View 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()
{

View 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.

View 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!;

View 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!;

View 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;

View 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";

View 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;

View 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>
{

View 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);

View 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()
{

View 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()
{

View 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()
{

View 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";

View 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()
{

View 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()
{

View 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";
}

View 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>();

View 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()

View 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)
{

View 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]

View 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()
{

View 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;

View 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!;

View 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)
{

View 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();