diff --git a/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs b/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs index da68653ce5..4f07c31009 100644 --- a/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs +++ b/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs @@ -15,6 +15,8 @@ namespace Content.Client.Access.UI; [GenerateTypedNameReferences] public sealed partial class GroupedAccessLevelChecklist : BoxContainer { + private static readonly ProtoId GeneralAccessGroup = "General"; + [Dependency] private readonly IPrototypeManager _protoManager = default!; private bool _isMonotone; @@ -63,7 +65,7 @@ public sealed partial class GroupedAccessLevelChecklist : BoxContainer // Ensure that the 'general' access group is added to handle // misc. access levels that aren't associated with any group - if (_protoManager.TryIndex("General", out var generalAccessProto)) + if (_protoManager.TryIndex(GeneralAccessGroup, out var generalAccessProto)) _groupedAccessLevels.TryAdd(generalAccessProto, new()); // Assign known access levels with their associated groups diff --git a/Content.Client/Delivery/DeliveryVisualizerSystem.cs b/Content.Client/Delivery/DeliveryVisualizerSystem.cs index 846688149f..d5afd34533 100644 --- a/Content.Client/Delivery/DeliveryVisualizerSystem.cs +++ b/Content.Client/Delivery/DeliveryVisualizerSystem.cs @@ -24,7 +24,7 @@ public sealed class DeliveryVisualizerSystem : VisualizerSystem(job, out var icon)) { - SpriteSystem.LayerSetTexture((uid, args.Sprite), DeliveryVisualLayers.JobStamp, SpriteSystem.Frame0(_prototype.Index("JobIconUnknown"))); + SpriteSystem.LayerSetTexture((uid, args.Sprite), DeliveryVisualLayers.JobStamp, SpriteSystem.Frame0(_prototype.Index(UnknownIcon).Icon)); return; } diff --git a/Content.Server/Botany/Systems/MutationSystem.cs b/Content.Server/Botany/Systems/MutationSystem.cs index 37b68d9475..ee35db48e3 100644 --- a/Content.Server/Botany/Systems/MutationSystem.cs +++ b/Content.Server/Botany/Systems/MutationSystem.cs @@ -9,13 +9,15 @@ namespace Content.Server.Botany; public sealed class MutationSystem : EntitySystem { + private static ProtoId RandomPlantMutations = "RandomPlantMutations"; + [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; private RandomPlantMutationListPrototype _randomMutations = default!; public override void Initialize() { - _randomMutations = _prototypeManager.Index("RandomPlantMutations"); + _randomMutations = _prototypeManager.Index(RandomPlantMutations); } /// diff --git a/Content.Server/Cluwne/CluwneSystem.cs b/Content.Server/Cluwne/CluwneSystem.cs index 73476ece17..2bad4e0b96 100644 --- a/Content.Server/Cluwne/CluwneSystem.cs +++ b/Content.Server/Cluwne/CluwneSystem.cs @@ -21,6 +21,8 @@ namespace Content.Server.Cluwne; public sealed class CluwneSystem : EntitySystem { + private static readonly ProtoId GeneticDamageGroup = "Genetic"; + [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; @@ -53,7 +55,7 @@ public sealed class CluwneSystem : EntitySystem RemComp(uid); RemComp(uid); RemComp(uid); - var damageSpec = new DamageSpecifier(_prototypeManager.Index("Genetic"), 300); + var damageSpec = new DamageSpecifier(_prototypeManager.Index(GeneticDamageGroup), 300); _damageableSystem.TryChangeDamage(uid, damageSpec); } } diff --git a/Content.Server/Destructible/Thresholds/Behaviors/WeightedSpawnEntityBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/WeightedSpawnEntityBehavior.cs index e02ed87322..96fa4dd438 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/WeightedSpawnEntityBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/WeightedSpawnEntityBehavior.cs @@ -19,6 +19,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors; [DataDefinition] public sealed partial class WeightedSpawnEntityBehavior : IThresholdBehavior { + private static readonly EntProtoId TempEntityProtoId = "TemporaryEntityForTimedDespawnSpawners"; + /// /// A table of entities with assigned weights to randomly pick from /// @@ -64,7 +66,7 @@ public sealed partial class WeightedSpawnEntityBehavior : IThresholdBehavior if (SpawnAfter != 0) { // if it fails to get the spawner, this won't ever work so just return - if (!system.PrototypeManager.TryIndex("TemporaryEntityForTimedDespawnSpawners", out var tempSpawnerProto)) + if (!system.PrototypeManager.TryIndex(TempEntityProtoId, out var tempSpawnerProto)) return; // spawn the spawner, assign it a lifetime, and assign the entity that it will spawn when despawned diff --git a/Content.Server/EntityEffects/EntityEffectSystem.cs b/Content.Server/EntityEffects/EntityEffectSystem.cs index e18b3b1470..54270ca53d 100644 --- a/Content.Server/EntityEffects/EntityEffectSystem.cs +++ b/Content.Server/EntityEffects/EntityEffectSystem.cs @@ -48,6 +48,8 @@ namespace Content.Server.EntityEffects; public sealed class EntityEffectSystem : EntitySystem { + private static readonly ProtoId RandomPickBotanyReagent = "RandomPickBotanyReagent"; + [Dependency] private readonly AtmosphereSystem _atmosphere = default!; [Dependency] private readonly BloodstreamSystem _bloodstream = default!; [Dependency] private readonly ChatSystem _chat = default!; @@ -854,7 +856,7 @@ public sealed class EntityEffectSystem : EntitySystem return; var chemicals = plantholder.Seed.Chemicals; - var randomChems = _protoManager.Index("RandomPickBotanyReagent").Fills; + var randomChems = _protoManager.Index(RandomPickBotanyReagent).Fills; // Add a random amount of a random chemical to this set of chemicals if (randomChems != null) diff --git a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs index 83471cdbc1..a88cf6b428 100644 --- a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs +++ b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs @@ -36,8 +36,9 @@ public sealed class GatewayGeneratorSystem : EntitySystem [Dependency] private readonly SharedSalvageSystem _salvage = default!; [Dependency] private readonly TileSystem _tile = default!; - [ValidatePrototypeId] - private const string PlanetNames = "NamesBorer"; + private static readonly ProtoId PlanetNames = "NamesBorer"; + private static readonly ProtoId BiomeTemplate = "Continental"; + private static readonly ProtoId DungeonConfig = "Experiment"; // TODO: // Fix shader some more @@ -101,7 +102,7 @@ public sealed class GatewayGeneratorSystem : EntitySystem var random = new Random(seed); var mapUid = _maps.CreateMap(); - var gatewayName = _salvage.GetFTLName(_protoManager.Index(PlanetNames), seed); + var gatewayName = _salvage.GetFTLName(_protoManager.Index(PlanetNames), seed); _metadata.SetEntityName(mapUid, gatewayName); var origin = new Vector2i(random.Next(-MaxOffset, MaxOffset), random.Next(-MaxOffset, MaxOffset)); @@ -111,7 +112,7 @@ public sealed class GatewayGeneratorSystem : EntitySystem }; AddComp(mapUid, restricted); - _biome.EnsurePlanet(mapUid, _protoManager.Index("Continental"), seed); + _biome.EnsurePlanet(mapUid, _protoManager.Index(BiomeTemplate), seed); var grid = Comp(mapUid); @@ -183,7 +184,7 @@ public sealed class GatewayGeneratorSystem : EntitySystem var dungeonRotation = _dungeon.GetDungeonRotation(seed); var dungeonPosition = (origin + dungeonRotation.RotateVec(new Vector2i(0, dungeonDistance))).Floored(); - _dungeon.GenerateDungeon(_protoManager.Index("Experiment"), args.MapUid, grid, dungeonPosition, seed); + _dungeon.GenerateDungeon(_protoManager.Index(DungeonConfig), args.MapUid, grid, dungeonPosition, seed); // TODO: Dungeon mobs + loot. diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 33de2c6f39..3e09d86189 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -74,6 +74,7 @@ namespace Content.Server.Ghost private EntityQuery _physicsQuery; private static readonly ProtoId AllowGhostShownByEventTag = "AllowGhostShownByEvent"; + private static readonly ProtoId AsphyxiationDamageType = "Asphyxiation"; public override void Initialize() { @@ -585,7 +586,7 @@ namespace Content.Server.Ghost dealtDamage = playerDeadThreshold - damageable.TotalDamage; } - DamageSpecifier damage = new(_prototypeManager.Index("Asphyxiation"), dealtDamage); + DamageSpecifier damage = new(_prototypeManager.Index(AsphyxiationDamageType), dealtDamage); _damageable.TryChangeDamage(playerEntity, damage, true); } diff --git a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs index a9d8314f57..aa501368de 100644 --- a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs +++ b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs @@ -8,8 +8,8 @@ namespace Content.Server.Salvage; public sealed partial class SalvageSystem { - [ValidatePrototypeId] - public const string CoordinatesDisk = "CoordinatesDisk"; + public static readonly EntProtoId CoordinatesDisk = "CoordinatesDisk"; + public static readonly ProtoId PlanetNames = "NamesBorer"; private void OnSalvageClaimMessage(EntityUid uid, SalvageExpeditionConsoleComponent component, ClaimSalvageMessage args) { @@ -28,7 +28,7 @@ public sealed partial class SalvageSystem var mission = GetMission(_prototypeManager.Index(missionparams.Difficulty), missionparams.Seed); data.NextOffer = _timing.CurTime + mission.Duration + TimeSpan.FromSeconds(1); - _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index("NamesBorer"), missionparams.Seed)); + _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index(PlanetNames), missionparams.Seed)); _audio.PlayPvs(component.PrintSound, uid); UpdateConsoles((station.Value, data)); diff --git a/Content.Server/Salvage/SpawnSalvageMissionJob.cs b/Content.Server/Salvage/SpawnSalvageMissionJob.cs index cbce4dc692..8b5e9898ad 100644 --- a/Content.Server/Salvage/SpawnSalvageMissionJob.cs +++ b/Content.Server/Salvage/SpawnSalvageMissionJob.cs @@ -100,7 +100,7 @@ public sealed class SpawnSalvageMissionJob : Job destComp.Enabled = true; _metaData.SetEntityName( mapUid, - _entManager.System().GetFTLName(_prototypeManager.Index("NamesBorer"), _missionParams.Seed)); + _entManager.System().GetFTLName(_prototypeManager.Index(SalvageSystem.PlanetNames), _missionParams.Seed)); _entManager.AddComponent(mapUid); // Saving the mission mapUid to a CD is made optional, in case one is somehow made in a process without a CD entity diff --git a/Content.Server/StationEvents/Events/RandomSentienceRule.cs b/Content.Server/StationEvents/Events/RandomSentienceRule.cs index 3d2e457a34..359c3edae4 100644 --- a/Content.Server/StationEvents/Events/RandomSentienceRule.cs +++ b/Content.Server/StationEvents/Events/RandomSentienceRule.cs @@ -11,6 +11,9 @@ namespace Content.Server.StationEvents.Events; public sealed class RandomSentienceRule : StationEventSystem { + private static readonly ProtoId DataSourceNames = "RandomSentienceEventData"; + private static readonly ProtoId IntelligenceLevelNames = "RandomSentienceEventStrength"; + [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IRobustRandom _random = default!; protected override void Started(EntityUid uid, RandomSentienceRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) @@ -72,8 +75,8 @@ public sealed class RandomSentienceRule : StationEventSystem("RandomSentienceEventData"))), - ("strength", _random.Pick(_prototype.Index("RandomSentienceEventStrength"))) + ("data", _random.Pick(_prototype.Index(DataSourceNames))), + ("strength", _random.Pick(_prototype.Index(IntelligenceLevelNames))) ), playDefaultSound: false, colorOverride: Color.Gold diff --git a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs index 0917197e29..78d270ddc9 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs @@ -8,12 +8,14 @@ using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Content.Shared.Movement.Components; using Robust.Shared.Containers; +using Robust.Shared.Prototypes; using Robust.Shared.Utility; namespace Content.Shared.Body.Systems; public partial class SharedBodySystem { + private static readonly ProtoId BloodlossDamageType = "Bloodloss"; private void InitializeParts() { // TODO: This doesn't handle comp removal on child ents. @@ -178,7 +180,7 @@ public partial class SharedBodySystem ) { // TODO BODY SYSTEM KILL : remove this when wounding and required parts are implemented properly - var damage = new DamageSpecifier(Prototypes.Index("Bloodloss"), 300); + var damage = new DamageSpecifier(Prototypes.Index(BloodlossDamageType), 300); Damageable.TryChangeDamage(bodyEnt, damage); } } diff --git a/Content.Shared/Chat/SharedSuicideSystem.cs b/Content.Shared/Chat/SharedSuicideSystem.cs index d341ea89a8..4b9eaf24b7 100644 --- a/Content.Shared/Chat/SharedSuicideSystem.cs +++ b/Content.Shared/Chat/SharedSuicideSystem.cs @@ -8,6 +8,8 @@ namespace Content.Shared.Chat; public sealed class SharedSuicideSystem : EntitySystem { + private static readonly ProtoId FallbackDamageType = "Blunt"; + [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; @@ -57,8 +59,8 @@ public sealed class SharedSuicideSystem : EntitySystem // We don't want structural damage for the same reasons listed above if (!_prototypeManager.TryIndex(damageType, out var damagePrototype) || damagePrototype.ID == "Structural") { - Log.Error($"{nameof(SharedSuicideSystem)} could not find the damage type prototype associated with {damageType}. Falling back to Blunt"); - damagePrototype = _prototypeManager.Index("Blunt"); + Log.Error($"{nameof(SharedSuicideSystem)} could not find the damage type prototype associated with {damageType}. Falling back to {FallbackDamageType}"); + damagePrototype = _prototypeManager.Index(FallbackDamageType); } var damage = new DamageSpecifier(damagePrototype, lethalAmountOfDamage); diff --git a/Content.Shared/Humanoid/NamingSystem.cs b/Content.Shared/Humanoid/NamingSystem.cs index a2085c6692..98afb34015 100644 --- a/Content.Shared/Humanoid/NamingSystem.cs +++ b/Content.Shared/Humanoid/NamingSystem.cs @@ -12,6 +12,8 @@ namespace Content.Shared.Humanoid /// public sealed class NamingSystem : EntitySystem { + private static readonly ProtoId FallbackSpecies = "Human"; + [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; @@ -21,8 +23,8 @@ namespace Content.Shared.Humanoid // Some downstream is probably gonna have this eventually but then they can deal with fallbacks. if (!_prototypeManager.TryIndex(species, out SpeciesPrototype? speciesProto)) { - speciesProto = _prototypeManager.Index("Human"); - Log.Warning($"Unable to find species {species} for name, falling back to Human"); + speciesProto = _prototypeManager.Index(FallbackSpecies); + Log.Warning($"Unable to find species {species} for name, falling back to {FallbackSpecies}"); } switch (speciesProto.Naming)