]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
CompFactory updates (#37559)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Tue, 20 May 2025 05:08:55 +0000 (15:08 +1000)
committerGitHub <noreply@github.com>
Tue, 20 May 2025 05:08:55 +0000 (01:08 -0400)
38 files changed:
Content.Client/Clothing/Systems/ChameleonClothingSystem.cs
Content.Client/Clothing/UI/ChameleonBoundUserInterface.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs
Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs
Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs
Content.IntegrationTests/Tests/MaterialArbitrageTest.cs
Content.IntegrationTests/Tests/Minds/RoleTests.cs
Content.IntegrationTests/Tests/StorageTest.cs
Content.Server/Cargo/Systems/PricingSystem.cs
Content.Server/Cloning/CloningSystem.cs
Content.Server/Clothing/Systems/ChameleonClothingSystem.cs
Content.Server/Construction/ConstructionSystem.Initial.cs
Content.Server/Construction/ConstructionSystem.Interactions.cs
Content.Server/Construction/MachineFrameSystem.cs
Content.Server/Destructible/DestructibleSystem.cs
Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs
Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs
Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs
Content.Server/GameTicking/Rules/SecretRuleSystem.cs
Content.Server/Holiday/Christmas/RandomGiftSystem.cs
Content.Server/NPC/HTN/PrimitiveTasks/Operators/PickAccessibleComponentOperator.cs
Content.Server/Parallax/BiomeSystem.cs
Content.Server/Payload/EntitySystems/PayloadSystem.cs
Content.Server/Polymorph/Systems/PolymorphSystem.cs
Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs
Content.Server/Shuttles/Systems/ShuttleSystem.cs
Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs
Content.Server/UserInterface/StatValuesCommand.cs
Content.Server/Weapons/Ranged/Systems/GunSystem.Battery.cs
Content.Server/Weapons/Ranged/Systems/GunSystem.Cartridges.cs
Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Content.Shared/Clothing/EntitySystems/SharedChameleonClothingSystem.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs
Content.Shared/Examine/ExamineSystemShared.Group.cs
Content.Shared/Magic/SharedMagicSystem.cs
Content.Shared/StatusEffect/StatusEffectsSystem.cs
Content.Shared/Whitelist/EntityWhitelistSystem.cs

index 330c0dfd446ed3f58f96fc5ff0a54c09dc225dad..bde6a4b99ab068239f2d56391467b19db17ace97 100644 (file)
@@ -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
index 6fafd45a5aa3070b05aeda00fed460ad791e3b87..bd86ffbec0b6a143afb6294a64b906e5d4486e97 100644 (file)
@@ -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);
index 3c8de7c445c065eccfe43f7f529bc0827d8a0fa3..de2f4e42b19eae7cdc1e659e0bd0eae2e907568e 100644 (file)
@@ -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<PointLightComponent>();
             light.NetSyncEnabled = false;
             AddComp(gunUid, light);
         }
index d3a10dcfaf4432bb49b5fb425c3db1510c5992fd..75281e63cb044f26b71ac3fda1003f8c845a1e4d 100644 (file)
@@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Construction
             var protoMan = server.ResolveDependency<IPrototypeManager>();
             var compFact = server.ResolveDependency<IComponentFactory>();
 
-            var name = compFact.GetComponentName(typeof(ConstructionComponent));
+            var name = compFact.GetComponentName<ConstructionComponent>();
             Assert.Multiple(() =>
             {
                 foreach (var proto in protoMan.EnumeratePrototypes<EntityPrototype>())
index 194bc54fba6ca029b552888f31e041abc900eba1..ca7445c359a649cbc45d4166d52aa98a04d2309f 100644 (file)
@@ -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<StackComponent>(), 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<StackComponent>(), out stack);
         });
 
         if (stack != null)
index 7f7de3318b4aef281cfc4746d86fbc42067e8738..34bf13e08764226b408e3c67844733d9375a19fb 100644 (file)
@@ -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<StackComponent>(), out stack);
                 });
 
                 if (stack == null)
index 2bf6c2bb32168e8d439b911f19f8c85c36595e30..3213ccbc430e0824b880718da1ca18a4ba10f774 100644 (file)
@@ -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<ConstructionComponent>();
+        var compositionName = compFact.GetComponentName<PhysicalCompositionComponent>();
+        var materialName = compFact.GetComponentName<MaterialComponent>();
+        var destructibleName = compFact.GetComponentName<DestructibleComponent>();
+        var refinableName = compFact.GetComponentName<ToolRefinableComponent>();
 
         // get the inverted lathe recipe dictionary
         var latheRecipes = latheSys.InverseRecipes;
index fcfe1236cfc411b78a089477edddb6387d37e4da..8acfff3fb96ff221ad472021813b963f9fff082a 100644 (file)
@@ -18,7 +18,7 @@ public sealed class RoleTests
     {
         await using var pair = await PoolManager.GetServerClient();
 
-        var jobComp = pair.Server.ResolveDependency<IComponentFactory>().GetComponentName(typeof(JobRoleComponent));
+        var jobComp = pair.Server.ResolveDependency<IComponentFactory>().GetComponentName<JobRoleComponent>();
 
         Assert.Multiple(() =>
         {
@@ -49,7 +49,7 @@ public sealed class RoleTests
     {
         await using var pair = await PoolManager.GetServerClient();
 
-        var mindCompId = pair.Server.ResolveDependency<IComponentFactory>().GetComponentName(typeof(MindRoleComponent));
+        var mindCompId = pair.Server.ResolveDependency<IComponentFactory>().GetComponentName<MindRoleComponent>();
 
         Assert.Multiple(() =>
         {
@@ -73,7 +73,7 @@ public sealed class RoleTests
         await using var pair = await PoolManager.GetServerClient();
 
         var refMan = pair.Server.ResolveDependency<IReflectionManager>();
-        var mindCompId = pair.Server.ResolveDependency<IComponentFactory>().GetComponentName(typeof(MindRoleComponent));
+        var mindCompId = pair.Server.ResolveDependency<IComponentFactory>().GetComponentName<MindRoleComponent>();
 
         var compTypes = refMan.GetAllChildren(typeof(BaseMindRoleComponent))
             .Append(typeof(RoleBriefingComponent))
index 983ec7093621b62368907783330f05566699cdae..13ddc56567bc1712623ea13f4cf78fcc86c2c373 100644 (file)
@@ -85,7 +85,7 @@ namespace Content.IntegrationTests.Tests
             var entMan = server.ResolveDependency<IEntityManager>();
             var protoMan = server.ResolveDependency<IPrototypeManager>();
             var compFact = server.ResolveDependency<IComponentFactory>();
-            var id = compFact.GetComponentName(typeof(StorageFillComponent));
+            var id = compFact.GetComponentName<StorageFillComponent>();
 
             var itemSys = entMan.System<SharedItemSystem>();
 
@@ -173,7 +173,7 @@ namespace Content.IntegrationTests.Tests
             var entMan = server.ResolveDependency<IEntityManager>();
             var protoMan = server.ResolveDependency<IPrototypeManager>();
             var compFact = server.ResolveDependency<IComponentFactory>();
-            var id = compFact.GetComponentName(typeof(StorageFillComponent));
+            var id = compFact.GetComponentName<StorageFillComponent>();
 
             var itemSys = entMan.System<SharedItemSystem>();
 
index edc273b3c1fa262525c830703f9f4b274ae81636..3d8a8075f5556c4afa2ba6dfe06851b622b60b0b 100644 (file)
@@ -25,7 +25,6 @@ namespace Content.Server.Cargo.Systems;
 /// </summary>
 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<MaterialComponent>()) &&
+            prototype.Components.TryGetValue(Factory.GetComponentName<PhysicalCompositionComponent>(), 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<StackComponent>(), 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<SolutionContainerManagerComponent>(), 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<StackPriceComponent>(), out var stackpriceProto) &&
+            prototype.Components.TryGetValue(Factory.GetComponentName<StackComponent>(), out var stackProto) &&
+            !prototype.Components.ContainsKey(Factory.GetComponentName<MaterialComponent>()))
         {
             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<StaticPriceComponent>(), out var staticProto))
         {
             var staticPrice = (StaticPriceComponent) staticProto.Component;
             price += staticPrice.Price;
index adf7acb7bd3ea33b35a61a9a9a00e43ddd26b857..effbc2159e64c3d3526f6330c59e85d566ceeb35 100644 (file)
@@ -26,7 +26,6 @@ namespace Content.Server.Cloning;
 /// </summary>
 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;
index 5c8954cc69b0a6c31d1f842660c1c666d30e7734..f3c7e316cae520ec337e32588383130cbe2ada19 100644 (file)
@@ -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<IdentityBlockerComponent>(_factory))
+        if (proto.HasComponent<IdentityBlockerComponent>(Factory))
             EnsureComp<IdentityBlockerComponent>(uid);
         else
             RemComp<IdentityBlockerComponent>(uid);
index 94bcc26bf841003ca02d0daf4cec5f9f8130cf6e..e489cdf1007519b2d1c67bd0189ffcc88b45a50f 100644 (file)
@@ -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<EntityUid>(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 _:
index 70a66c0ec7c5f9d9c86a3f9b148dd8c82262eb9c..74c856a6f17a8eff1ea353e02b8a60b7a521415e 100644 (file)
@@ -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
index 0fd5ad2e0e45084c089ff8423ffece70a3441ad2..b8624aeef28cb51f965f7079ce1c0561185a9305 100644 (file)
@@ -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;
index ca7f975e608f377df9e43593cbdd5d6cc18bddd1..82d5ffcb9acdd977bd3e3796ed86c470305b2594 100644 (file)
@@ -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()
index e13fd5e05beb60658132da7f29223454ed6e90eb..a8448a1b7f27b8248c3d9fda1ae7ef3302cfd4e7 100644 (file)
@@ -40,7 +40,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
 
                 if (toSpawn == 0) continue;
 
-                if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
+                if (EntityPrototypeHelpers.HasComponent<StackComponent>(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);
index 4ec6fa9e908e56a2b2ee73d0c6ee35079293b35b..413991515b9475828d2a3346270b32bee7708ede 100644 (file)
@@ -53,7 +53,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
                     if (count == 0)
                         continue;
 
-                    if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
+                    if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.EntityManager.ComponentFactory))
                     {
                         var spawned = SpawnInContainer
                             ? system.EntityManager.SpawnNextToOrDrop(entityId, owner)
index 89950edf8c094fa50f3c1cc4a5b3798eb4394f01..cdab2883f53a2ed2b6045a48fa8900622491ce7a 100644 (file)
@@ -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))
index e82cecde3683d0b85aacd4f36b833fe0e655ba96..5e8e599d106cc63d858167a3f7d6dae06e1e04fc 100644 (file)
@@ -21,14 +21,13 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
     [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<GameRuleComponent>();
     }
 
     protected override void Added(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)
index 559dc9856ebf1a7cc6a61061efae4d43b22cda61..17a2d8ac2bcdd59ad771131a8771fe6ed507f34d 100644 (file)
@@ -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<ItemComponent>();
+        var mapGridCompName = Factory.GetComponentName<MapGridComponent>();
+        var physicsCompName = Factory.GetComponentName<PhysicsComponent>();
 
         foreach (var proto in _prototype.EnumeratePrototypes<EntityPrototype>())
         {
index 9f89669f2d2b980dfdf8d7bcf0a0eb21a8cd8ce3..0edcee7b286d8188b7b5ad749404626fc66a7b4c 100644 (file)
@@ -11,7 +11,6 @@ namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
 /// </summary>
 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);
         }
index 8dac0bbb7589150e35702411c4af3793bac845f7..9ea252c27e43daf0e085519b4f1741622e2fe53a 100644 (file)
@@ -1011,7 +1011,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
             return;
 
         EnsureComp<MapGridComponent>(mapUid);
-        var biome = (BiomeComponent) EntityManager.ComponentFactory.GetComponent(typeof(BiomeComponent));
+        var biome = EntityManager.ComponentFactory.GetComponent<BiomeComponent>();
         seed ??= _random.Next();
         SetSeed(mapUid, biome, seed.Value, false);
         SetTemplate(mapUid, biome, biomeTemplate, false);
index bf562f747f98aaf5ea598f8ecb8de729d59b912a..e16e8884b2192d42744bbe8627d7de4852ed886a 100644 (file)
@@ -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<TagPrototype> 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;
index 64dbcec54707ec52123876e938fbe99925dcfaf8..b87e3febee6283995564c931e7c1827ed627a119 100644 (file)
@@ -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<PolymorphedEntityComponent>();
+        var polymorphedComp = Factory.GetComponent<PolymorphedEntityComponent>();
         polymorphedComp.Parent = uid;
         polymorphedComp.Configuration = configuration;
         AddComp(child, polymorphedComp);
index 6123f348ec83b1486aa5178d44a4ba614205af71..a794ee0104216d13837972f4f076d8a8a3cddbe5 100644 (file)
@@ -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);
             }
         }
index 4b0e076a4f2a0bf28140f54f3bff3af77e88a1cf..90d77a8ec9a7ddef54d5cf29463235402700d911 100644 (file)
@@ -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!;
index d55c6e6764d25c7d7bfad70225d0fa59b1e3da0a..98d35efae4b084a1be3975be6ab9d995b16c4033 100644 (file)
@@ -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;
     }
index 85b979f83a7487c71fc24bba9aa30a054d325b9e..d64984b5744ced3e118687ffd377801eaff2e155 100644 (file)
@@ -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<string[]>();
-        var meleeName = _factory.GetComponentName(typeof(MeleeWeaponComponent));
+        var meleeName = _entManager.ComponentFactory.GetComponentName<MeleeWeaponComponent>();
 
         foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
         {
@@ -257,7 +256,7 @@ public sealed class StatValuesCommand : IConsoleCommand
     private StatValuesEuiMessage GetDrawRateMessage()
     {
         var values = new List<string[]>();
-        var powerName = _factory.GetComponentName(typeof(ApcPowerReceiverComponent));
+        var powerName = _entManager.ComponentFactory.GetComponentName<ApcPowerReceiverComponent>();
 
         foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
         {
index 1cb19f075589dfe62c694212e3fb7f3c97217e34..4865d08782d70088bf4861971a82807a1ae12cb7 100644 (file)
@@ -96,7 +96,7 @@ public sealed partial class GunSystem
         if (component is ProjectileBatteryAmmoProviderComponent battery)
         {
             if (ProtoManager.Index<EntityPrototype>(battery.Prototype).Components
-                .TryGetValue(_factory.GetComponentName(typeof(ProjectileComponent)), out var projectile))
+                .TryGetValue(Factory.GetComponentName<ProjectileComponent>(), out var projectile))
             {
                 var p = (ProjectileComponent) projectile.Component;
 
index c1df560cb7d524396c5547497391a685df12f6b2..770bd2f7b6a3e21ba54a4436e5501dba3222da65 100644 (file)
@@ -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<ProjectileComponent>(), out var projectile))
         {
             var p = (ProjectileComponent) projectile.Component;
 
index dd5edaac6b6eac02ab4019801e2f4c16e6b9ea8b..6ee3baae657527820b3e62d13d274d628e50f06a 100644 (file)
@@ -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;
index f996c65fe821aef99d582ad26a8e7cfe5f81b212..6c5fbdfb0b01b184ec41d8bbc9960a45e6a1dbbf 100644 (file)
@@ -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))
index 9c38667399802385928ecda819b0882422b9c0db..8c4a87117703792e62f6f34ef177ba182cf83a1f 100644 (file)
@@ -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<Container>(uid, _componentFactory.GetComponentName(component.GetType()));
+            component.Container = _container.EnsureContainer<Container>(uid, Factory.GetComponentName(component.GetType()));
         }
 
         private void OnRejuvenate(EntityUid uid, CuffableComponent component, RejuvenateEvent args)
index 7dc7877eacf97981c7b1e8b4b6dbb983f26ca2d5..e220d3ef7732b61f5b10ebe952ccc3a50fb9edb5 100644 (file)
@@ -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<GroupExamineComponent>(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
         /// </summary>
         public void AddDetailedExamineVerb(GetVerbsEvent<ExamineVerb> 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);
         }
 
index 820b0999a80afb512689a729d0221bb31b1427a1..4bfe2e1fe56a6589782823b67f823b85da144c23 100644 (file)
@@ -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);
         }
     }
index 95abea63db0decb5c91ec6f5b2d8a6f995538098..5fa634351d02abccfc19ab2ec640a9d215f1bf8b 100644 (file)
@@ -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<EntityUid> _toRemove = new();
@@ -119,7 +118,7 @@ namespace Content.Shared.StatusEffect
                 return true;
 
             EntityManager.AddComponent<T>(uid);
-            status.ActiveEffects[key].RelevantComponent = _componentFactory.GetComponentName<T>();
+            status.ActiveEffects[key].RelevantComponent = Factory.GetComponentName<T>();
             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);
index b33bbf2586f38e3e614df58b8c4439f1b4a8bb1d..69d9921efac9000669d147f714b52b91db6a4510 100644 (file)
@@ -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<ItemComponent> _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);