From 0d4f9640b5782d0eb9601168f745a1444d12dcb7 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 20 May 2025 15:08:55 +1000 Subject: [PATCH] CompFactory updates (#37559) --- .../Clothing/Systems/ChameleonClothingSystem.cs | 7 +++---- .../Clothing/UI/ChameleonBoundUserInterface.cs | 3 +-- .../Weapons/Ranged/Systems/GunSystem.cs | 3 +-- .../Construction/ConstructionPrototypeTest.cs | 2 +- .../InteractionTest.EntitySpecifier.cs | 4 ++-- ...InteractionTest.EntitySpecifierCollection.cs | 2 +- .../Tests/MaterialArbitrageTest.cs | 10 +++++----- .../Tests/Minds/RoleTests.cs | 6 +++--- Content.IntegrationTests/Tests/StorageTest.cs | 4 ++-- Content.Server/Cargo/Systems/PricingSystem.cs | 17 ++++++++--------- Content.Server/Cloning/CloningSystem.cs | 5 ++--- .../Clothing/Systems/ChameleonClothingSystem.cs | 3 +-- .../Construction/ConstructionSystem.Initial.cs | 5 ++--- .../ConstructionSystem.Interactions.cs | 2 +- .../Construction/MachineFrameSystem.cs | 5 ++--- .../Destructible/DestructibleSystem.cs | 1 - .../Behaviors/DumpRestockInventory.cs | 2 +- .../Behaviors/SpawnEntitiesBehavior.cs | 2 +- .../EntitySystems/TwoStageTriggerSystem.cs | 3 +-- .../GameTicking/Rules/SecretRuleSystem.cs | 3 +-- .../Holiday/Christmas/RandomGiftSystem.cs | 7 +++---- .../PickAccessibleComponentOperator.cs | 3 +-- Content.Server/Parallax/BiomeSystem.cs | 2 +- .../Payload/EntitySystems/PayloadSystem.cs | 5 ++--- .../Polymorph/Systems/PolymorphSystem.cs | 3 +-- .../Shuttles/Systems/ShuttleSystem.GridFill.cs | 2 +- .../Shuttles/Systems/ShuttleSystem.cs | 1 - .../EntitySystems/AddAccentClothingSystem.cs | 13 ++++--------- .../UserInterface/StatValuesCommand.cs | 5 ++--- .../Weapons/Ranged/Systems/GunSystem.Battery.cs | 2 +- .../Ranged/Systems/GunSystem.Cartridges.cs | 2 +- .../Weapons/Ranged/Systems/GunSystem.cs | 3 --- .../SharedChameleonClothingSystem.cs | 5 ++--- Content.Shared/Cuffs/SharedCuffableSystem.cs | 3 +-- .../Examine/ExamineSystemShared.Group.cs | 8 +++----- Content.Shared/Magic/SharedMagicSystem.cs | 5 ++--- .../StatusEffect/StatusEffectsSystem.cs | 9 ++++----- .../Whitelist/EntityWhitelistSystem.cs | 5 ++--- 38 files changed, 70 insertions(+), 102 deletions(-) diff --git a/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs b/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs index 330c0dfd44..bde6a4b99a 100644 --- a/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs +++ b/Content.Client/Clothing/Systems/ChameleonClothingSystem.cs @@ -12,7 +12,6 @@ namespace Content.Client.Clothing.Systems; public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem { [Dependency] private readonly IPrototypeManager _proto = default!; - [Dependency] private readonly IComponentFactory _factory = default!; private static readonly SlotFlags[] IgnoredSlots = { @@ -48,14 +47,14 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem { base.UpdateSprite(uid, proto); if (TryComp(uid, out SpriteComponent? sprite) - && proto.TryGetComponent(out SpriteComponent? otherSprite, _factory)) + && proto.TryGetComponent(out SpriteComponent? otherSprite, Factory)) { sprite.CopyFrom(otherSprite); } // Edgecase for PDAs to include visuals when UI is open if (TryComp(uid, out PdaBorderColorComponent? borderColor) - && proto.TryGetComponent(out PdaBorderColorComponent? otherBorderColor, _factory)) + && proto.TryGetComponent(out PdaBorderColorComponent? otherBorderColor, Factory)) { borderColor.BorderColor = otherBorderColor.BorderColor; borderColor.AccentHColor = otherBorderColor.AccentHColor; @@ -89,7 +88,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem // check if this is valid clothing if (!IsValidTarget(proto)) continue; - if (!proto.TryGetComponent(out ClothingComponent? item, _factory)) + if (!proto.TryGetComponent(out ClothingComponent? item, Factory)) continue; // sort item by their slot flags diff --git a/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs b/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs index 6fafd45a5a..bd86ffbec0 100644 --- a/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs +++ b/Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs @@ -12,7 +12,6 @@ namespace Content.Client.Clothing.UI; [UsedImplicitly] public sealed class ChameleonBoundUserInterface : BoundUserInterface { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IPrototypeManager _proto = default!; private readonly ChameleonClothingSystem _chameleon; private readonly TagSystem _tag; @@ -49,7 +48,7 @@ public sealed class ChameleonBoundUserInterface : BoundUserInterface if (string.IsNullOrEmpty(target) || !_proto.TryIndex(target, out EntityPrototype? proto)) continue; - if (!proto.TryGetComponent(out TagComponent? tag, _factory) || !_tag.HasTag(tag, st.RequiredTag)) + if (!proto.TryGetComponent(out TagComponent? tag, EntMan.ComponentFactory) || !_tag.HasTag(tag, st.RequiredTag)) continue; newTargets.Add(target); diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index 3c8de7c445..de2f4e42b1 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -28,7 +28,6 @@ namespace Content.Client.Weapons.Ranged.Systems; public sealed partial class GunSystem : SharedGunSystem { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IPlayerManager _player = default!; @@ -361,7 +360,7 @@ public sealed partial class GunSystem : SharedGunSystem _animPlayer.Play(ent, anim, "muzzle-flash"); if (!TryComp(gunUid, out PointLightComponent? light)) { - light = (PointLightComponent) _factory.GetComponent(typeof(PointLightComponent)); + light = Factory.GetComponent(); light.NetSyncEnabled = false; AddComp(gunUid, light); } diff --git a/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs index d3a10dcfaf..75281e63cb 100644 --- a/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs +++ b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs @@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Construction var protoMan = server.ResolveDependency(); var compFact = server.ResolveDependency(); - var name = compFact.GetComponentName(typeof(ConstructionComponent)); + var name = compFact.GetComponentName(); Assert.Multiple(() => { foreach (var proto in protoMan.EnumeratePrototypes()) diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs index 194bc54fba..ca7445c359 100644 --- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs +++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs @@ -77,7 +77,7 @@ public abstract partial class InteractionTest StackComponent? stack = null; await server.WaitPost(() => { - entProto.TryGetComponent(factory.GetComponentName(typeof(StackComponent)), out stack); + entProto.TryGetComponent(factory.GetComponentName(), out stack); }); if (stack != null) @@ -107,7 +107,7 @@ public abstract partial class InteractionTest StackComponent? stack = null; await Server.WaitPost(() => { - entProto.TryGetComponent(Factory.GetComponentName(typeof(StackComponent)), out stack); + entProto.TryGetComponent(Factory.GetComponentName(), out stack); }); if (stack != null) diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs index 7f7de3318b..34bf13e087 100644 --- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs +++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs @@ -134,7 +134,7 @@ public abstract partial class InteractionTest StackComponent? stack = null; await server.WaitPost(() => { - entProto.TryGetComponent(factory.GetComponentName(typeof(StackComponent)), out stack); + entProto.TryGetComponent(factory.GetComponentName(), out stack); }); if (stack == null) diff --git a/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs b/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs index 2bf6c2bb32..3213ccbc43 100644 --- a/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs +++ b/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs @@ -63,11 +63,11 @@ public sealed class MaterialArbitrageTest Assert.That(mapSystem.IsInitialized(testMap.MapId)); - var constructionName = compFact.GetComponentName(typeof(ConstructionComponent)); - var compositionName = compFact.GetComponentName(typeof(PhysicalCompositionComponent)); - var materialName = compFact.GetComponentName(typeof(MaterialComponent)); - var destructibleName = compFact.GetComponentName(typeof(DestructibleComponent)); - var refinableName = compFact.GetComponentName(typeof(ToolRefinableComponent)); + var constructionName = compFact.GetComponentName(); + var compositionName = compFact.GetComponentName(); + var materialName = compFact.GetComponentName(); + var destructibleName = compFact.GetComponentName(); + var refinableName = compFact.GetComponentName(); // get the inverted lathe recipe dictionary var latheRecipes = latheSys.InverseRecipes; diff --git a/Content.IntegrationTests/Tests/Minds/RoleTests.cs b/Content.IntegrationTests/Tests/Minds/RoleTests.cs index fcfe1236cf..8acfff3fb9 100644 --- a/Content.IntegrationTests/Tests/Minds/RoleTests.cs +++ b/Content.IntegrationTests/Tests/Minds/RoleTests.cs @@ -18,7 +18,7 @@ public sealed class RoleTests { await using var pair = await PoolManager.GetServerClient(); - var jobComp = pair.Server.ResolveDependency().GetComponentName(typeof(JobRoleComponent)); + var jobComp = pair.Server.ResolveDependency().GetComponentName(); Assert.Multiple(() => { @@ -49,7 +49,7 @@ public sealed class RoleTests { await using var pair = await PoolManager.GetServerClient(); - var mindCompId = pair.Server.ResolveDependency().GetComponentName(typeof(MindRoleComponent)); + var mindCompId = pair.Server.ResolveDependency().GetComponentName(); Assert.Multiple(() => { @@ -73,7 +73,7 @@ public sealed class RoleTests await using var pair = await PoolManager.GetServerClient(); var refMan = pair.Server.ResolveDependency(); - var mindCompId = pair.Server.ResolveDependency().GetComponentName(typeof(MindRoleComponent)); + var mindCompId = pair.Server.ResolveDependency().GetComponentName(); var compTypes = refMan.GetAllChildren(typeof(BaseMindRoleComponent)) .Append(typeof(RoleBriefingComponent)) diff --git a/Content.IntegrationTests/Tests/StorageTest.cs b/Content.IntegrationTests/Tests/StorageTest.cs index 983ec70936..13ddc56567 100644 --- a/Content.IntegrationTests/Tests/StorageTest.cs +++ b/Content.IntegrationTests/Tests/StorageTest.cs @@ -85,7 +85,7 @@ namespace Content.IntegrationTests.Tests var entMan = server.ResolveDependency(); var protoMan = server.ResolveDependency(); var compFact = server.ResolveDependency(); - var id = compFact.GetComponentName(typeof(StorageFillComponent)); + var id = compFact.GetComponentName(); var itemSys = entMan.System(); @@ -173,7 +173,7 @@ namespace Content.IntegrationTests.Tests var entMan = server.ResolveDependency(); var protoMan = server.ResolveDependency(); var compFact = server.ResolveDependency(); - var id = compFact.GetComponentName(typeof(StorageFillComponent)); + var id = compFact.GetComponentName(); var itemSys = entMan.System(); diff --git a/Content.Server/Cargo/Systems/PricingSystem.cs b/Content.Server/Cargo/Systems/PricingSystem.cs index edc273b3c1..3d8a8075f5 100644 --- a/Content.Server/Cargo/Systems/PricingSystem.cs +++ b/Content.Server/Cargo/Systems/PricingSystem.cs @@ -25,7 +25,6 @@ namespace Content.Server.Cargo.Systems; /// public sealed class PricingSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IConsoleHost _consoleHost = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly BodySystem _bodySystem = default!; @@ -278,13 +277,13 @@ public sealed class PricingSystem : EntitySystem { double price = 0; - if (prototype.Components.ContainsKey(_factory.GetComponentName(typeof(MaterialComponent))) && - prototype.Components.TryGetValue(_factory.GetComponentName(typeof(PhysicalCompositionComponent)), out var composition)) + if (prototype.Components.ContainsKey(Factory.GetComponentName()) && + prototype.Components.TryGetValue(Factory.GetComponentName(), out var composition)) { var compositionComp = (PhysicalCompositionComponent) composition.Component; var matPrice = GetMaterialPrice(compositionComp); - if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackComponent)), out var stackProto)) + if (prototype.Components.TryGetValue(Factory.GetComponentName(), out var stackProto)) { matPrice *= ((StackComponent) stackProto.Component).Count; } @@ -311,7 +310,7 @@ public sealed class PricingSystem : EntitySystem { var price = 0.0; - if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(SolutionContainerManagerComponent)), out var solManager)) + if (prototype.Components.TryGetValue(Factory.GetComponentName(), out var solManager)) { var solComp = (SolutionContainerManagerComponent) solManager.Component; price += GetSolutionPrice(solComp); @@ -338,9 +337,9 @@ public sealed class PricingSystem : EntitySystem { var price = 0.0; - if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackPriceComponent)), out var stackpriceProto) && - prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackComponent)), out var stackProto) && - !prototype.Components.ContainsKey(_factory.GetComponentName(typeof(MaterialComponent)))) + if (prototype.Components.TryGetValue(Factory.GetComponentName(), out var stackpriceProto) && + prototype.Components.TryGetValue(Factory.GetComponentName(), out var stackProto) && + !prototype.Components.ContainsKey(Factory.GetComponentName())) { var stackPrice = (StackPriceComponent) stackpriceProto.Component; var stack = (StackComponent) stackProto.Component; @@ -366,7 +365,7 @@ public sealed class PricingSystem : EntitySystem { var price = 0.0; - if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StaticPriceComponent)), out var staticProto)) + if (prototype.Components.TryGetValue(Factory.GetComponentName(), out var staticProto)) { var staticPrice = (StaticPriceComponent) staticProto.Component; price += staticPrice.Price; diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index adf7acb7bd..effbc2159e 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -26,7 +26,6 @@ namespace Content.Server.Cloning; /// public sealed partial class CloningSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!; [Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly MetaDataSystem _metaData = default!; @@ -106,7 +105,7 @@ public sealed partial class CloningSystem : EntitySystem foreach (var componentName in componentsToCopy) { - if (!_componentFactory.TryGetRegistration(componentName, out var componentRegistration)) + if (!Factory.TryGetRegistration(componentName, out var componentRegistration)) { Log.Error($"Tried to use invalid component registration for cloning: {componentName}"); continue; @@ -122,7 +121,7 @@ public sealed partial class CloningSystem : EntitySystem foreach (var componentName in componentsToEvent) { - if (!_componentFactory.TryGetRegistration(componentName, out var componentRegistration)) + if (!Factory.TryGetRegistration(componentName, out var componentRegistration)) { Log.Error($"Tried to use invalid component registration for cloning: {componentName}"); continue; diff --git a/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs b/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs index 5c8954cc69..f3c7e316ca 100644 --- a/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs +++ b/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs @@ -10,7 +10,6 @@ namespace Content.Server.Clothing.Systems; public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem { [Dependency] private readonly IPrototypeManager _proto = default!; - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IdentitySystem _identity = default!; public override void Initialize() @@ -68,7 +67,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem private void UpdateIdentityBlocker(EntityUid uid, ChameleonClothingComponent component, EntityPrototype proto) { - if (proto.HasComponent(_factory)) + if (proto.HasComponent(Factory)) EnsureComp(uid); else RemComp(uid); diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index 94bcc26bf8..e489cdf100 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -24,7 +24,6 @@ namespace Content.Server.Construction { public sealed partial class ConstructionSystem { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; @@ -210,7 +209,7 @@ namespace Content.Server.Construction case ArbitraryInsertConstructionGraphStep arbitraryStep: foreach (var entity in new HashSet(EnumerateNearby(user))) { - if (!arbitraryStep.EntityValid(entity, EntityManager, _factory)) + if (!arbitraryStep.EntityValid(entity, EntityManager, Factory)) continue; if (used.Contains(entity)) @@ -510,7 +509,7 @@ namespace Content.Server.Construction switch (step) { case EntityInsertConstructionGraphStep entityInsert: - if (entityInsert.EntityValid(holding, EntityManager, _factory)) + if (entityInsert.EntityValid(holding, EntityManager, Factory)) valid = true; break; case ToolConstructionGraphStep _: diff --git a/Content.Server/Construction/ConstructionSystem.Interactions.cs b/Content.Server/Construction/ConstructionSystem.Interactions.cs index 70a66c0ec7..74c856a6f1 100644 --- a/Content.Server/Construction/ConstructionSystem.Interactions.cs +++ b/Content.Server/Construction/ConstructionSystem.Interactions.cs @@ -273,7 +273,7 @@ namespace Content.Server.Construction // Since many things inherit this step, we delegate the "is this entity valid?" logic to them. // While this is very OOP and I find it icky, I must admit that it simplifies the code here a lot. - if(!insertStep.EntityValid(insert, EntityManager, _factory)) + if(!insertStep.EntityValid(insert, EntityManager, Factory)) return HandleResult.False; // Unremovable items can't be inserted, unless they are a lingering stack diff --git a/Content.Server/Construction/MachineFrameSystem.cs b/Content.Server/Construction/MachineFrameSystem.cs index 0fd5ad2e0e..b8624aeef2 100644 --- a/Content.Server/Construction/MachineFrameSystem.cs +++ b/Content.Server/Construction/MachineFrameSystem.cs @@ -13,7 +13,6 @@ namespace Content.Server.Construction; public sealed class MachineFrameSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly StackSystem _stack = default!; @@ -75,7 +74,7 @@ public sealed class MachineFrameSystem : EntitySystem if (component.ComponentProgress[compName] >= info.Amount) continue; - var registration = _factory.GetRegistration(compName); + var registration = Factory.GetRegistration(compName); if (!HasComp(args.Used, registration.Type)) continue; @@ -294,7 +293,7 @@ public sealed class MachineFrameSystem : EntitySystem // I have many regrets. foreach (var (compName, _) in component.ComponentRequirements) { - var registration = _factory.GetRegistration(compName); + var registration = Factory.GetRegistration(compName); if (!HasComp(part, registration.Type)) continue; diff --git a/Content.Server/Destructible/DestructibleSystem.cs b/Content.Server/Destructible/DestructibleSystem.cs index ca7f975e60..82d5ffcb9a 100644 --- a/Content.Server/Destructible/DestructibleSystem.cs +++ b/Content.Server/Destructible/DestructibleSystem.cs @@ -43,7 +43,6 @@ namespace Content.Server.Destructible [Dependency] public readonly PuddleSystem PuddleSystem = default!; [Dependency] public readonly SharedContainerSystem ContainerSystem = default!; [Dependency] public readonly IPrototypeManager PrototypeManager = default!; - [Dependency] public readonly IComponentFactory ComponentFactory = default!; [Dependency] public readonly IAdminLogManager _adminLogger = default!; public override void Initialize() diff --git a/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs b/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs index e13fd5e05b..a8448a1b7f 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs @@ -40,7 +40,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors if (toSpawn == 0) continue; - if (EntityPrototypeHelpers.HasComponent(entityId, system.PrototypeManager, system.ComponentFactory)) + if (EntityPrototypeHelpers.HasComponent(entityId, system.PrototypeManager, system.EntityManager.ComponentFactory)) { var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset))); system.StackSystem.SetCount(spawned, toSpawn); diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs index 4ec6fa9e90..413991515b 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs @@ -53,7 +53,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors if (count == 0) continue; - if (EntityPrototypeHelpers.HasComponent(entityId, system.PrototypeManager, system.ComponentFactory)) + if (EntityPrototypeHelpers.HasComponent(entityId, system.PrototypeManager, system.EntityManager.ComponentFactory)) { var spawned = SpawnInContainer ? system.EntityManager.SpawnNextToOrDrop(entityId, owner) diff --git a/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs index 89950edf8c..cdab2883f5 100644 --- a/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs @@ -6,7 +6,6 @@ namespace Content.Server.Explosion.EntitySystems; public sealed class TwoStageTriggerSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!; [Dependency] private readonly TriggerSystem _triggerSystem = default!; @@ -30,7 +29,7 @@ public sealed class TwoStageTriggerSystem : EntitySystem { foreach (var (name, entry) in component.SecondStageComponents) { - var comp = (Component)_factory.GetComponent(name); + var comp = (Component) Factory.GetComponent(name); var temp = (object)comp; if (EntityManager.TryGetComponent(uid, entry.Component.GetType(), out var c)) diff --git a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs index e82cecde36..5e8e599d10 100644 --- a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs @@ -21,14 +21,13 @@ public sealed class SecretRuleSystem : GameRuleSystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; - [Dependency] private readonly IComponentFactory _compFact = default!; private string _ruleCompName = default!; public override void Initialize() { base.Initialize(); - _ruleCompName = _compFact.GetComponentName(typeof(GameRuleComponent)); + _ruleCompName = Factory.GetComponentName(); } protected override void Added(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) diff --git a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs index 559dc9856e..17a2d8ac2b 100644 --- a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs +++ b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs @@ -20,7 +20,6 @@ public sealed class RandomGiftSystem : EntitySystem { [Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly HandsSystem _hands = default!; - [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; @@ -93,9 +92,9 @@ public sealed class RandomGiftSystem : EntitySystem { _possibleGiftsSafe.Clear(); _possibleGiftsUnsafe.Clear(); - var itemCompName = _componentFactory.GetComponentName(typeof(ItemComponent)); - var mapGridCompName = _componentFactory.GetComponentName(typeof(MapGridComponent)); - var physicsCompName = _componentFactory.GetComponentName(typeof(PhysicsComponent)); + var itemCompName = Factory.GetComponentName(); + var mapGridCompName = Factory.GetComponentName(); + var physicsCompName = Factory.GetComponentName(); foreach (var proto in _prototype.EnumeratePrototypes()) { diff --git a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/PickAccessibleComponentOperator.cs b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/PickAccessibleComponentOperator.cs index 9f89669f2d..0edcee7b28 100644 --- a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/PickAccessibleComponentOperator.cs +++ b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/PickAccessibleComponentOperator.cs @@ -11,7 +11,6 @@ namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators; /// public sealed partial class PickAccessibleComponentOperator : HTNOperator { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IEntityManager _entManager = default!; private PathfindingSystem _pathfinding = default!; private EntityLookupSystem _lookup = default!; @@ -46,7 +45,7 @@ public sealed partial class PickAccessibleComponentOperator : HTNOperator CancellationToken cancelToken) { // Check if the component exists - if (!_factory.TryGetRegistration(Component, out var registration)) + if (!_entManager.ComponentFactory.TryGetRegistration(Component, out var registration)) { return (false, null); } diff --git a/Content.Server/Parallax/BiomeSystem.cs b/Content.Server/Parallax/BiomeSystem.cs index 8dac0bbb75..9ea252c27e 100644 --- a/Content.Server/Parallax/BiomeSystem.cs +++ b/Content.Server/Parallax/BiomeSystem.cs @@ -1011,7 +1011,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem return; EnsureComp(mapUid); - var biome = (BiomeComponent) EntityManager.ComponentFactory.GetComponent(typeof(BiomeComponent)); + var biome = EntityManager.ComponentFactory.GetComponent(); seed ??= _random.Next(); SetSeed(mapUid, biome, seed.Value, false); SetTemplate(mapUid, biome, biomeTemplate, false); diff --git a/Content.Server/Payload/EntitySystems/PayloadSystem.cs b/Content.Server/Payload/EntitySystems/PayloadSystem.cs index bf562f747f..e16e8884b2 100644 --- a/Content.Server/Payload/EntitySystems/PayloadSystem.cs +++ b/Content.Server/Payload/EntitySystems/PayloadSystem.cs @@ -21,7 +21,6 @@ public sealed class PayloadSystem : EntitySystem [Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly TransformSystem _transform = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; - [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!; private static readonly ProtoId PayloadTag = "Payload"; @@ -92,13 +91,13 @@ public sealed class PayloadSystem : EntitySystem // ANY payload trigger that gets inserted can grant components. It is up to the construction graphs to determine trigger capacity. foreach (var (name, data) in trigger.Components) { - if (!_componentFactory.TryGetRegistration(name, out var registration)) + if (!Factory.TryGetRegistration(name, out var registration)) continue; if (HasComp(uid, registration.Type)) continue; - if (_componentFactory.GetComponent(registration.Type) is not Component component) + if (Factory.GetComponent(registration.Type) is not Component component) continue; var temp = (object) component; diff --git a/Content.Server/Polymorph/Systems/PolymorphSystem.cs b/Content.Server/Polymorph/Systems/PolymorphSystem.cs index 64dbcec547..b87e3febee 100644 --- a/Content.Server/Polymorph/Systems/PolymorphSystem.cs +++ b/Content.Server/Polymorph/Systems/PolymorphSystem.cs @@ -28,7 +28,6 @@ namespace Content.Server.Polymorph.Systems; public sealed partial class PolymorphSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _compFact = default!; [Dependency] private readonly SharedMapSystem _map = default!; [Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; @@ -213,7 +212,7 @@ public sealed partial class PolymorphSystem : EntitySystem MakeSentientCommand.MakeSentient(child, EntityManager); - var polymorphedComp = _compFact.GetComponent(); + var polymorphedComp = Factory.GetComponent(); polymorphedComp.Parent = uid; polymorphedComp.Configuration = configuration; AddComp(child, polymorphedComp); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs index 6123f348ec..a794ee0104 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs @@ -271,7 +271,7 @@ public sealed partial class ShuttleSystem if (HasComp(grid.Value, compType)) continue; - var comp = _factory.GetComponent(compType); + var comp = Factory.GetComponent(compType); AddComp(grid.Value, comp, true); } } diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index 4b0e076a4f..90d77a8ec9 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -40,7 +40,6 @@ namespace Content.Server.Shuttles.Systems; public sealed partial class ShuttleSystem : SharedShuttleSystem { [Dependency] private readonly IAdminLogManager _logger = default!; - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IMapManager _mapManager = default!; diff --git a/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs b/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs index d55c6e6764..98d35efae4 100644 --- a/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs +++ b/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs @@ -5,8 +5,6 @@ namespace Content.Server.Speech.EntitySystems; public sealed class AddAccentClothingSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _componentFactory = default!; - public override void Initialize() { base.Initialize(); @@ -19,12 +17,12 @@ public sealed class AddAccentClothingSystem : EntitySystem private void OnGotEquipped(EntityUid uid, AddAccentClothingComponent component, ref ClothingGotEquippedEvent args) { // does the user already has this accent? - var componentType = _componentFactory.GetRegistration(component.Accent).Type; + var componentType = Factory.GetRegistration(component.Accent).Type; if (HasComp(args.Wearer, componentType)) return; // add accent to the user - var accentComponent = (Component) _componentFactory.GetComponent(componentType); + var accentComponent = (Component) Factory.GetComponent(componentType); AddComp(args.Wearer, accentComponent); // snowflake case for replacement accent @@ -40,11 +38,8 @@ public sealed class AddAccentClothingSystem : EntitySystem return; // try to remove accent - var componentType = _componentFactory.GetRegistration(component.Accent).Type; - if (EntityManager.HasComponent(args.Wearer, componentType)) - { - EntityManager.RemoveComponent(args.Wearer, componentType); - } + var componentType = Factory.GetRegistration(component.Accent).Type; + EntityManager.RemoveComponent(args.Wearer, componentType); component.IsActive = false; } diff --git a/Content.Server/UserInterface/StatValuesCommand.cs b/Content.Server/UserInterface/StatValuesCommand.cs index 85b979f83a..d64984b574 100644 --- a/Content.Server/UserInterface/StatValuesCommand.cs +++ b/Content.Server/UserInterface/StatValuesCommand.cs @@ -19,7 +19,6 @@ namespace Content.Server.UserInterface; public sealed class StatValuesCommand : IConsoleCommand { [Dependency] private readonly EuiManager _eui = default!; - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IPrototypeManager _proto = default!; @@ -174,7 +173,7 @@ public sealed class StatValuesCommand : IConsoleCommand private StatValuesEuiMessage GetMelee() { var values = new List(); - var meleeName = _factory.GetComponentName(typeof(MeleeWeaponComponent)); + var meleeName = _entManager.ComponentFactory.GetComponentName(); foreach (var proto in _proto.EnumeratePrototypes()) { @@ -257,7 +256,7 @@ public sealed class StatValuesCommand : IConsoleCommand private StatValuesEuiMessage GetDrawRateMessage() { var values = new List(); - var powerName = _factory.GetComponentName(typeof(ApcPowerReceiverComponent)); + var powerName = _entManager.ComponentFactory.GetComponentName(); foreach (var proto in _proto.EnumeratePrototypes()) { diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.Battery.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.Battery.cs index 1cb19f0755..4865d08782 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.Battery.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.Battery.cs @@ -96,7 +96,7 @@ public sealed partial class GunSystem if (component is ProjectileBatteryAmmoProviderComponent battery) { if (ProtoManager.Index(battery.Prototype).Components - .TryGetValue(_factory.GetComponentName(typeof(ProjectileComponent)), out var projectile)) + .TryGetValue(Factory.GetComponentName(), out var projectile)) { var p = (ProjectileComponent) projectile.Component; diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.Cartridges.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.Cartridges.cs index c1df560cb7..770bd2f7b6 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.Cartridges.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.Cartridges.cs @@ -33,7 +33,7 @@ public sealed partial class GunSystem return null; if (entityProto.Components - .TryGetValue(_factory.GetComponentName(typeof(ProjectileComponent)), out var projectile)) + .TryGetValue(Factory.GetComponentName(), out var projectile)) { var p = (ProjectileComponent) projectile.Component; diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs index dd5edaac6b..6ee3baae65 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs @@ -28,14 +28,11 @@ namespace Content.Server.Weapons.Ranged.Systems; public sealed partial class GunSystem : SharedGunSystem { - [Dependency] private readonly IComponentFactory _factory = default!; - [Dependency] private readonly BatterySystem _battery = default!; [Dependency] private readonly DamageExamineSystem _damageExamine = default!; [Dependency] private readonly PricingSystem _pricing = default!; [Dependency] private readonly SharedColorFlashEffectSystem _color = default!; [Dependency] private readonly SharedStaminaSystem _stamina = default!; [Dependency] private readonly SharedContainerSystem _container = default!; - [Dependency] private readonly PowerCellSystem _powerCell = default!; [Dependency] private readonly SharedMapSystem _map = default!; private const float DamagePitchVariation = 0.05f; diff --git a/Content.Shared/Clothing/EntitySystems/SharedChameleonClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/SharedChameleonClothingSystem.cs index f996c65fe8..6c5fbdfb0b 100644 --- a/Content.Shared/Clothing/EntitySystems/SharedChameleonClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/SharedChameleonClothingSystem.cs @@ -13,7 +13,6 @@ namespace Content.Shared.Clothing.EntitySystems; public abstract class SharedChameleonClothingSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly ClothingSystem _clothingSystem = default!; [Dependency] private readonly ContrabandSystem _contraband = default!; @@ -66,7 +65,7 @@ public abstract class SharedChameleonClothingSystem : EntitySystem // item sprite logic if (TryComp(uid, out ItemComponent? item) && - proto.TryGetComponent(out ItemComponent? otherItem, _factory)) + proto.TryGetComponent(out ItemComponent? otherItem, Factory)) { _itemSystem.CopyVisuals(uid, otherItem, item); } @@ -126,7 +125,7 @@ public abstract class SharedChameleonClothingSystem : EntitySystem return false; // check if it is marked as valid chameleon target - if (!proto.TryGetComponent(out TagComponent? tag, _factory) || !_tag.HasTag(tag, WhitelistChameleonTag)) + if (!proto.TryGetComponent(out TagComponent? tag, Factory) || !_tag.HasTag(tag, WhitelistChameleonTag)) return false; if (requiredTag != null && !_tag.HasTag(tag, requiredTag)) diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 9c38667399..8c4a871177 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -40,7 +40,6 @@ namespace Content.Shared.Cuffs // TODO remove all the IsServer() checks. public abstract partial class SharedCuffableSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly INetManager _net = default!; [Dependency] private readonly ISharedAdminLogManager _adminLog = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; @@ -146,7 +145,7 @@ namespace Content.Shared.Cuffs private void OnStartup(EntityUid uid, CuffableComponent component, ComponentInit args) { - component.Container = _container.EnsureContainer(uid, _componentFactory.GetComponentName(component.GetType())); + component.Container = _container.EnsureContainer(uid, Factory.GetComponentName(component.GetType())); } private void OnRejuvenate(EntityUid uid, CuffableComponent component, RejuvenateEvent args) diff --git a/Content.Shared/Examine/ExamineSystemShared.Group.cs b/Content.Shared/Examine/ExamineSystemShared.Group.cs index 7dc7877eac..e220d3ef77 100644 --- a/Content.Shared/Examine/ExamineSystemShared.Group.cs +++ b/Content.Shared/Examine/ExamineSystemShared.Group.cs @@ -6,8 +6,6 @@ namespace Content.Shared.Examine { public abstract partial class ExamineSystemShared : EntitySystem { - [Dependency] private readonly IComponentFactory _componentFactory = default!; - public const string DefaultIconTexture = "/Textures/Interface/examine-star.png"; public override void Initialize() @@ -55,7 +53,7 @@ namespace Content.Shared.Examine { foreach (var comp in components) { - if (!_componentFactory.TryGetRegistration(comp, out var componentRegistration)) + if (!Factory.TryGetRegistration(comp, out var componentRegistration)) continue; if (!HasComp(uid, componentRegistration.Type)) @@ -117,7 +115,7 @@ namespace Content.Shared.Examine if (TryComp(verbsEvent.Target, out var groupExamine)) { // Make sure we have the component name as a string - var componentName = _componentFactory.GetComponentName(component.GetType()); + var componentName = Factory.GetComponentName(component.GetType()); foreach (var examineGroup in groupExamine.Group) { @@ -177,7 +175,7 @@ namespace Content.Shared.Examine /// public void AddDetailedExamineVerb(GetVerbsEvent verbsEvent, Component component, FormattedMessage message, string verbText, string iconTexture = DefaultIconTexture, string hoverMessage = "", bool isHoverExamine = false) { - var componentName = _componentFactory.GetComponentName(component.GetType()); + var componentName = Factory.GetComponentName(component.GetType()); AddDetailedExamineVerb(verbsEvent, component, new ExamineEntry(componentName, 0f, message), verbText, iconTexture, hoverMessage, isHoverExamine); } diff --git a/Content.Shared/Magic/SharedMagicSystem.cs b/Content.Shared/Magic/SharedMagicSystem.cs index 820b0999a8..4bfe2e1fe5 100644 --- a/Content.Shared/Magic/SharedMagicSystem.cs +++ b/Content.Shared/Magic/SharedMagicSystem.cs @@ -43,7 +43,6 @@ namespace Content.Shared.Magic; public abstract class SharedMagicSystem : EntitySystem { [Dependency] private readonly ISerializationManager _seriMan = default!; - [Dependency] private readonly IComponentFactory _compFact = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly SharedMapSystem _mapSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; @@ -356,7 +355,7 @@ public abstract class SharedMagicSystem : EntitySystem if (HasComp(target, data.Component.GetType())) continue; - var component = (Component)_compFact.GetComponent(name); + var component = (Component)Factory.GetComponent(name); var temp = (object)component; _seriMan.CopyTo(data.Component, ref temp); EntityManager.AddComponent(target, (Component)temp!); @@ -367,7 +366,7 @@ public abstract class SharedMagicSystem : EntitySystem { foreach (var toRemove in comps) { - if (_compFact.TryGetRegistration(toRemove, out var registration)) + if (Factory.TryGetRegistration(toRemove, out var registration)) RemComp(target, registration.Type); } } diff --git a/Content.Shared/StatusEffect/StatusEffectsSystem.cs b/Content.Shared/StatusEffect/StatusEffectsSystem.cs index 95abea63db..5fa634351d 100644 --- a/Content.Shared/StatusEffect/StatusEffectsSystem.cs +++ b/Content.Shared/StatusEffect/StatusEffectsSystem.cs @@ -11,7 +11,6 @@ namespace Content.Shared.StatusEffect public sealed class StatusEffectsSystem : EntitySystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!; private List _toRemove = new(); @@ -119,7 +118,7 @@ namespace Content.Shared.StatusEffect return true; EntityManager.AddComponent(uid); - status.ActiveEffects[key].RelevantComponent = _componentFactory.GetComponentName(); + status.ActiveEffects[key].RelevantComponent = Factory.GetComponentName(); return true; } @@ -133,9 +132,9 @@ namespace Content.Shared.StatusEffect if (TryAddStatusEffect(uid, key, time, refresh, status)) { // If they already have the comp, we just won't bother updating anything. - if (!EntityManager.HasComponent(uid, _componentFactory.GetRegistration(component).Type)) + if (!EntityManager.HasComponent(uid, Factory.GetRegistration(component).Type)) { - var newComponent = (Component) _componentFactory.GetComponent(component); + var newComponent = (Component) Factory.GetComponent(component); EntityManager.AddComponent(uid, newComponent); status.ActiveEffects[key].RelevantComponent = component; } @@ -271,7 +270,7 @@ namespace Content.Shared.StatusEffect // There are cases where a status effect component might be server-only, so TryGetRegistration... if (remComp && state.RelevantComponent != null - && _componentFactory.TryGetRegistration(state.RelevantComponent, out var registration)) + && Factory.TryGetRegistration(state.RelevantComponent, out var registration)) { var type = registration.Type; EntityManager.RemoveComponent(uid, type); diff --git a/Content.Shared/Whitelist/EntityWhitelistSystem.cs b/Content.Shared/Whitelist/EntityWhitelistSystem.cs index b33bbf2586..69d9921efa 100644 --- a/Content.Shared/Whitelist/EntityWhitelistSystem.cs +++ b/Content.Shared/Whitelist/EntityWhitelistSystem.cs @@ -6,7 +6,6 @@ namespace Content.Shared.Whitelist; public sealed class EntityWhitelistSystem : EntitySystem { - [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly TagSystem _tag = default!; private EntityQuery _itemQuery; @@ -178,8 +177,8 @@ public sealed class EntityWhitelistSystem : EntitySystem foreach (var name in input) { - var availability = _factory.GetComponentAvailability(name); - if (_factory.TryGetRegistration(name, out var registration) + var availability = Factory.GetComponentAvailability(name); + if (Factory.TryGetRegistration(name, out var registration) && availability == ComponentAvailability.Available) { list.Add(registration);