CompFactory updates (#37559)

This commit is contained in:
metalgearsloth
2025-05-20 15:08:55 +10:00
committed by GitHub
parent bc0139f961
commit 0d4f9640b5
38 changed files with 70 additions and 102 deletions

View File

@@ -12,7 +12,6 @@ namespace Content.Client.Clothing.Systems;
public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
{ {
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IComponentFactory _factory = default!;
private static readonly SlotFlags[] IgnoredSlots = private static readonly SlotFlags[] IgnoredSlots =
{ {
@@ -48,14 +47,14 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
{ {
base.UpdateSprite(uid, proto); base.UpdateSprite(uid, proto);
if (TryComp(uid, out SpriteComponent? sprite) if (TryComp(uid, out SpriteComponent? sprite)
&& proto.TryGetComponent(out SpriteComponent? otherSprite, _factory)) && proto.TryGetComponent(out SpriteComponent? otherSprite, Factory))
{ {
sprite.CopyFrom(otherSprite); sprite.CopyFrom(otherSprite);
} }
// Edgecase for PDAs to include visuals when UI is open // Edgecase for PDAs to include visuals when UI is open
if (TryComp(uid, out PdaBorderColorComponent? borderColor) if (TryComp(uid, out PdaBorderColorComponent? borderColor)
&& proto.TryGetComponent(out PdaBorderColorComponent? otherBorderColor, _factory)) && proto.TryGetComponent(out PdaBorderColorComponent? otherBorderColor, Factory))
{ {
borderColor.BorderColor = otherBorderColor.BorderColor; borderColor.BorderColor = otherBorderColor.BorderColor;
borderColor.AccentHColor = otherBorderColor.AccentHColor; borderColor.AccentHColor = otherBorderColor.AccentHColor;
@@ -89,7 +88,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
// check if this is valid clothing // check if this is valid clothing
if (!IsValidTarget(proto)) if (!IsValidTarget(proto))
continue; continue;
if (!proto.TryGetComponent(out ClothingComponent? item, _factory)) if (!proto.TryGetComponent(out ClothingComponent? item, Factory))
continue; continue;
// sort item by their slot flags // sort item by their slot flags

View File

@@ -12,7 +12,6 @@ namespace Content.Client.Clothing.UI;
[UsedImplicitly] [UsedImplicitly]
public sealed class ChameleonBoundUserInterface : BoundUserInterface public sealed class ChameleonBoundUserInterface : BoundUserInterface
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
private readonly ChameleonClothingSystem _chameleon; private readonly ChameleonClothingSystem _chameleon;
private readonly TagSystem _tag; private readonly TagSystem _tag;
@@ -49,7 +48,7 @@ public sealed class ChameleonBoundUserInterface : BoundUserInterface
if (string.IsNullOrEmpty(target) || !_proto.TryIndex(target, out EntityPrototype? proto)) if (string.IsNullOrEmpty(target) || !_proto.TryIndex(target, out EntityPrototype? proto))
continue; 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; continue;
newTargets.Add(target); newTargets.Add(target);

View File

@@ -28,7 +28,6 @@ namespace Content.Client.Weapons.Ranged.Systems;
public sealed partial class GunSystem : SharedGunSystem public sealed partial class GunSystem : SharedGunSystem
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IPlayerManager _player = default!; [Dependency] private readonly IPlayerManager _player = default!;
@@ -361,7 +360,7 @@ public sealed partial class GunSystem : SharedGunSystem
_animPlayer.Play(ent, anim, "muzzle-flash"); _animPlayer.Play(ent, anim, "muzzle-flash");
if (!TryComp(gunUid, out PointLightComponent? light)) if (!TryComp(gunUid, out PointLightComponent? light))
{ {
light = (PointLightComponent) _factory.GetComponent(typeof(PointLightComponent)); light = Factory.GetComponent<PointLightComponent>();
light.NetSyncEnabled = false; light.NetSyncEnabled = false;
AddComp(gunUid, light); AddComp(gunUid, light);
} }

View File

@@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Construction
var protoMan = server.ResolveDependency<IPrototypeManager>(); var protoMan = server.ResolveDependency<IPrototypeManager>();
var compFact = server.ResolveDependency<IComponentFactory>(); var compFact = server.ResolveDependency<IComponentFactory>();
var name = compFact.GetComponentName(typeof(ConstructionComponent)); var name = compFact.GetComponentName<ConstructionComponent>();
Assert.Multiple(() => Assert.Multiple(() =>
{ {
foreach (var proto in protoMan.EnumeratePrototypes<EntityPrototype>()) foreach (var proto in protoMan.EnumeratePrototypes<EntityPrototype>())

View File

@@ -77,7 +77,7 @@ public abstract partial class InteractionTest
StackComponent? stack = null; StackComponent? stack = null;
await server.WaitPost(() => await server.WaitPost(() =>
{ {
entProto.TryGetComponent(factory.GetComponentName(typeof(StackComponent)), out stack); entProto.TryGetComponent(factory.GetComponentName<StackComponent>(), out stack);
}); });
if (stack != null) if (stack != null)
@@ -107,7 +107,7 @@ public abstract partial class InteractionTest
StackComponent? stack = null; StackComponent? stack = null;
await Server.WaitPost(() => await Server.WaitPost(() =>
{ {
entProto.TryGetComponent(Factory.GetComponentName(typeof(StackComponent)), out stack); entProto.TryGetComponent(Factory.GetComponentName<StackComponent>(), out stack);
}); });
if (stack != null) if (stack != null)

View File

@@ -134,7 +134,7 @@ public abstract partial class InteractionTest
StackComponent? stack = null; StackComponent? stack = null;
await server.WaitPost(() => await server.WaitPost(() =>
{ {
entProto.TryGetComponent(factory.GetComponentName(typeof(StackComponent)), out stack); entProto.TryGetComponent(factory.GetComponentName<StackComponent>(), out stack);
}); });
if (stack == null) if (stack == null)

View File

@@ -63,11 +63,11 @@ public sealed class MaterialArbitrageTest
Assert.That(mapSystem.IsInitialized(testMap.MapId)); Assert.That(mapSystem.IsInitialized(testMap.MapId));
var constructionName = compFact.GetComponentName(typeof(ConstructionComponent)); var constructionName = compFact.GetComponentName<ConstructionComponent>();
var compositionName = compFact.GetComponentName(typeof(PhysicalCompositionComponent)); var compositionName = compFact.GetComponentName<PhysicalCompositionComponent>();
var materialName = compFact.GetComponentName(typeof(MaterialComponent)); var materialName = compFact.GetComponentName<MaterialComponent>();
var destructibleName = compFact.GetComponentName(typeof(DestructibleComponent)); var destructibleName = compFact.GetComponentName<DestructibleComponent>();
var refinableName = compFact.GetComponentName(typeof(ToolRefinableComponent)); var refinableName = compFact.GetComponentName<ToolRefinableComponent>();
// get the inverted lathe recipe dictionary // get the inverted lathe recipe dictionary
var latheRecipes = latheSys.InverseRecipes; var latheRecipes = latheSys.InverseRecipes;

View File

@@ -18,7 +18,7 @@ public sealed class RoleTests
{ {
await using var pair = await PoolManager.GetServerClient(); 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(() => Assert.Multiple(() =>
{ {
@@ -49,7 +49,7 @@ public sealed class RoleTests
{ {
await using var pair = await PoolManager.GetServerClient(); 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(() => Assert.Multiple(() =>
{ {
@@ -73,7 +73,7 @@ public sealed class RoleTests
await using var pair = await PoolManager.GetServerClient(); await using var pair = await PoolManager.GetServerClient();
var refMan = pair.Server.ResolveDependency<IReflectionManager>(); 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)) var compTypes = refMan.GetAllChildren(typeof(BaseMindRoleComponent))
.Append(typeof(RoleBriefingComponent)) .Append(typeof(RoleBriefingComponent))

View File

@@ -85,7 +85,7 @@ namespace Content.IntegrationTests.Tests
var entMan = server.ResolveDependency<IEntityManager>(); var entMan = server.ResolveDependency<IEntityManager>();
var protoMan = server.ResolveDependency<IPrototypeManager>(); var protoMan = server.ResolveDependency<IPrototypeManager>();
var compFact = server.ResolveDependency<IComponentFactory>(); var compFact = server.ResolveDependency<IComponentFactory>();
var id = compFact.GetComponentName(typeof(StorageFillComponent)); var id = compFact.GetComponentName<StorageFillComponent>();
var itemSys = entMan.System<SharedItemSystem>(); var itemSys = entMan.System<SharedItemSystem>();
@@ -173,7 +173,7 @@ namespace Content.IntegrationTests.Tests
var entMan = server.ResolveDependency<IEntityManager>(); var entMan = server.ResolveDependency<IEntityManager>();
var protoMan = server.ResolveDependency<IPrototypeManager>(); var protoMan = server.ResolveDependency<IPrototypeManager>();
var compFact = server.ResolveDependency<IComponentFactory>(); var compFact = server.ResolveDependency<IComponentFactory>();
var id = compFact.GetComponentName(typeof(StorageFillComponent)); var id = compFact.GetComponentName<StorageFillComponent>();
var itemSys = entMan.System<SharedItemSystem>(); var itemSys = entMan.System<SharedItemSystem>();

View File

@@ -25,7 +25,6 @@ namespace Content.Server.Cargo.Systems;
/// </summary> /// </summary>
public sealed class PricingSystem : EntitySystem public sealed class PricingSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IConsoleHost _consoleHost = default!; [Dependency] private readonly IConsoleHost _consoleHost = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly BodySystem _bodySystem = default!;
@@ -278,13 +277,13 @@ public sealed class PricingSystem : EntitySystem
{ {
double price = 0; double price = 0;
if (prototype.Components.ContainsKey(_factory.GetComponentName(typeof(MaterialComponent))) && if (prototype.Components.ContainsKey(Factory.GetComponentName<MaterialComponent>()) &&
prototype.Components.TryGetValue(_factory.GetComponentName(typeof(PhysicalCompositionComponent)), out var composition)) prototype.Components.TryGetValue(Factory.GetComponentName<PhysicalCompositionComponent>(), out var composition))
{ {
var compositionComp = (PhysicalCompositionComponent) composition.Component; var compositionComp = (PhysicalCompositionComponent) composition.Component;
var matPrice = GetMaterialPrice(compositionComp); 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; matPrice *= ((StackComponent) stackProto.Component).Count;
} }
@@ -311,7 +310,7 @@ public sealed class PricingSystem : EntitySystem
{ {
var price = 0.0; 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; var solComp = (SolutionContainerManagerComponent) solManager.Component;
price += GetSolutionPrice(solComp); price += GetSolutionPrice(solComp);
@@ -338,9 +337,9 @@ public sealed class PricingSystem : EntitySystem
{ {
var price = 0.0; var price = 0.0;
if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackPriceComponent)), out var stackpriceProto) && if (prototype.Components.TryGetValue(Factory.GetComponentName<StackPriceComponent>(), out var stackpriceProto) &&
prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StackComponent)), out var stackProto) && prototype.Components.TryGetValue(Factory.GetComponentName<StackComponent>(), out var stackProto) &&
!prototype.Components.ContainsKey(_factory.GetComponentName(typeof(MaterialComponent)))) !prototype.Components.ContainsKey(Factory.GetComponentName<MaterialComponent>()))
{ {
var stackPrice = (StackPriceComponent) stackpriceProto.Component; var stackPrice = (StackPriceComponent) stackpriceProto.Component;
var stack = (StackComponent) stackProto.Component; var stack = (StackComponent) stackProto.Component;
@@ -366,7 +365,7 @@ public sealed class PricingSystem : EntitySystem
{ {
var price = 0.0; 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; var staticPrice = (StaticPriceComponent) staticProto.Component;
price += staticPrice.Price; price += staticPrice.Price;

View File

@@ -26,7 +26,6 @@ namespace Content.Server.Cloning;
/// </summary> /// </summary>
public sealed partial class CloningSystem : EntitySystem public sealed partial class CloningSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!; [Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!;
[Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!; [Dependency] private readonly MetaDataSystem _metaData = default!;
@@ -106,7 +105,7 @@ public sealed partial class CloningSystem : EntitySystem
foreach (var componentName in componentsToCopy) 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}"); Log.Error($"Tried to use invalid component registration for cloning: {componentName}");
continue; continue;
@@ -122,7 +121,7 @@ public sealed partial class CloningSystem : EntitySystem
foreach (var componentName in componentsToEvent) 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}"); Log.Error($"Tried to use invalid component registration for cloning: {componentName}");
continue; continue;

View File

@@ -10,7 +10,6 @@ namespace Content.Server.Clothing.Systems;
public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
{ {
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IdentitySystem _identity = default!; [Dependency] private readonly IdentitySystem _identity = default!;
public override void Initialize() public override void Initialize()
@@ -68,7 +67,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
private void UpdateIdentityBlocker(EntityUid uid, ChameleonClothingComponent component, EntityPrototype proto) private void UpdateIdentityBlocker(EntityUid uid, ChameleonClothingComponent component, EntityPrototype proto)
{ {
if (proto.HasComponent<IdentityBlockerComponent>(_factory)) if (proto.HasComponent<IdentityBlockerComponent>(Factory))
EnsureComp<IdentityBlockerComponent>(uid); EnsureComp<IdentityBlockerComponent>(uid);
else else
RemComp<IdentityBlockerComponent>(uid); RemComp<IdentityBlockerComponent>(uid);

View File

@@ -24,7 +24,6 @@ namespace Content.Server.Construction
{ {
public sealed partial class ConstructionSystem public sealed partial class ConstructionSystem
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
@@ -210,7 +209,7 @@ namespace Content.Server.Construction
case ArbitraryInsertConstructionGraphStep arbitraryStep: case ArbitraryInsertConstructionGraphStep arbitraryStep:
foreach (var entity in new HashSet<EntityUid>(EnumerateNearby(user))) foreach (var entity in new HashSet<EntityUid>(EnumerateNearby(user)))
{ {
if (!arbitraryStep.EntityValid(entity, EntityManager, _factory)) if (!arbitraryStep.EntityValid(entity, EntityManager, Factory))
continue; continue;
if (used.Contains(entity)) if (used.Contains(entity))
@@ -510,7 +509,7 @@ namespace Content.Server.Construction
switch (step) switch (step)
{ {
case EntityInsertConstructionGraphStep entityInsert: case EntityInsertConstructionGraphStep entityInsert:
if (entityInsert.EntityValid(holding, EntityManager, _factory)) if (entityInsert.EntityValid(holding, EntityManager, Factory))
valid = true; valid = true;
break; break;
case ToolConstructionGraphStep _: case ToolConstructionGraphStep _:

View 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. // 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. // 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; return HandleResult.False;
// Unremovable items can't be inserted, unless they are a lingering stack // Unremovable items can't be inserted, unless they are a lingering stack

View File

@@ -13,7 +13,6 @@ namespace Content.Server.Construction;
public sealed class MachineFrameSystem : EntitySystem public sealed class MachineFrameSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly StackSystem _stack = default!; [Dependency] private readonly StackSystem _stack = default!;
@@ -75,7 +74,7 @@ public sealed class MachineFrameSystem : EntitySystem
if (component.ComponentProgress[compName] >= info.Amount) if (component.ComponentProgress[compName] >= info.Amount)
continue; continue;
var registration = _factory.GetRegistration(compName); var registration = Factory.GetRegistration(compName);
if (!HasComp(args.Used, registration.Type)) if (!HasComp(args.Used, registration.Type))
continue; continue;
@@ -294,7 +293,7 @@ public sealed class MachineFrameSystem : EntitySystem
// I have many regrets. // I have many regrets.
foreach (var (compName, _) in component.ComponentRequirements) foreach (var (compName, _) in component.ComponentRequirements)
{ {
var registration = _factory.GetRegistration(compName); var registration = Factory.GetRegistration(compName);
if (!HasComp(part, registration.Type)) if (!HasComp(part, registration.Type))
continue; continue;

View File

@@ -43,7 +43,6 @@ namespace Content.Server.Destructible
[Dependency] public readonly PuddleSystem PuddleSystem = default!; [Dependency] public readonly PuddleSystem PuddleSystem = default!;
[Dependency] public readonly SharedContainerSystem ContainerSystem = default!; [Dependency] public readonly SharedContainerSystem ContainerSystem = default!;
[Dependency] public readonly IPrototypeManager PrototypeManager = default!; [Dependency] public readonly IPrototypeManager PrototypeManager = default!;
[Dependency] public readonly IComponentFactory ComponentFactory = default!;
[Dependency] public readonly IAdminLogManager _adminLogger = default!; [Dependency] public readonly IAdminLogManager _adminLogger = default!;
public override void Initialize() public override void Initialize()

View File

@@ -40,7 +40,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
if (toSpawn == 0) continue; 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))); var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset)));
system.StackSystem.SetCount(spawned, toSpawn); system.StackSystem.SetCount(spawned, toSpawn);

View File

@@ -53,7 +53,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
if (count == 0) if (count == 0)
continue; continue;
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory)) if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.EntityManager.ComponentFactory))
{ {
var spawned = SpawnInContainer var spawned = SpawnInContainer
? system.EntityManager.SpawnNextToOrDrop(entityId, owner) ? system.EntityManager.SpawnNextToOrDrop(entityId, owner)

View File

@@ -6,7 +6,6 @@ namespace Content.Server.Explosion.EntitySystems;
public sealed class TwoStageTriggerSystem : EntitySystem public sealed class TwoStageTriggerSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!;
[Dependency] private readonly TriggerSystem _triggerSystem = default!; [Dependency] private readonly TriggerSystem _triggerSystem = default!;
@@ -30,7 +29,7 @@ public sealed class TwoStageTriggerSystem : EntitySystem
{ {
foreach (var (name, entry) in component.SecondStageComponents) foreach (var (name, entry) in component.SecondStageComponents)
{ {
var comp = (Component)_factory.GetComponent(name); var comp = (Component) Factory.GetComponent(name);
var temp = (object)comp; var temp = (object)comp;
if (EntityManager.TryGetComponent(uid, entry.Component.GetType(), out var c)) if (EntityManager.TryGetComponent(uid, entry.Component.GetType(), out var c))

View File

@@ -21,14 +21,13 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IComponentFactory _compFact = default!;
private string _ruleCompName = default!; private string _ruleCompName = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
_ruleCompName = _compFact.GetComponentName(typeof(GameRuleComponent)); _ruleCompName = Factory.GetComponentName<GameRuleComponent>();
} }
protected override void Added(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) protected override void Added(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)

View File

@@ -20,7 +20,6 @@ public sealed class RandomGiftSystem : EntitySystem
{ {
[Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly HandsSystem _hands = default!; [Dependency] private readonly HandsSystem _hands = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
@@ -93,9 +92,9 @@ public sealed class RandomGiftSystem : EntitySystem
{ {
_possibleGiftsSafe.Clear(); _possibleGiftsSafe.Clear();
_possibleGiftsUnsafe.Clear(); _possibleGiftsUnsafe.Clear();
var itemCompName = _componentFactory.GetComponentName(typeof(ItemComponent)); var itemCompName = Factory.GetComponentName<ItemComponent>();
var mapGridCompName = _componentFactory.GetComponentName(typeof(MapGridComponent)); var mapGridCompName = Factory.GetComponentName<MapGridComponent>();
var physicsCompName = _componentFactory.GetComponentName(typeof(PhysicsComponent)); var physicsCompName = Factory.GetComponentName<PhysicsComponent>();
foreach (var proto in _prototype.EnumeratePrototypes<EntityPrototype>()) foreach (var proto in _prototype.EnumeratePrototypes<EntityPrototype>())
{ {

View File

@@ -11,7 +11,6 @@ namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
/// </summary> /// </summary>
public sealed partial class PickAccessibleComponentOperator : HTNOperator public sealed partial class PickAccessibleComponentOperator : HTNOperator
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IEntityManager _entManager = default!;
private PathfindingSystem _pathfinding = default!; private PathfindingSystem _pathfinding = default!;
private EntityLookupSystem _lookup = default!; private EntityLookupSystem _lookup = default!;
@@ -46,7 +45,7 @@ public sealed partial class PickAccessibleComponentOperator : HTNOperator
CancellationToken cancelToken) CancellationToken cancelToken)
{ {
// Check if the component exists // Check if the component exists
if (!_factory.TryGetRegistration(Component, out var registration)) if (!_entManager.ComponentFactory.TryGetRegistration(Component, out var registration))
{ {
return (false, null); return (false, null);
} }

View File

@@ -1011,7 +1011,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
return; return;
EnsureComp<MapGridComponent>(mapUid); EnsureComp<MapGridComponent>(mapUid);
var biome = (BiomeComponent) EntityManager.ComponentFactory.GetComponent(typeof(BiomeComponent)); var biome = EntityManager.ComponentFactory.GetComponent<BiomeComponent>();
seed ??= _random.Next(); seed ??= _random.Next();
SetSeed(mapUid, biome, seed.Value, false); SetSeed(mapUid, biome, seed.Value, false);
SetTemplate(mapUid, biome, biomeTemplate, false); SetTemplate(mapUid, biome, biomeTemplate, false);

View File

@@ -21,7 +21,6 @@ public sealed class PayloadSystem : EntitySystem
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly TransformSystem _transform = default!; [Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!;
private static readonly ProtoId<TagPrototype> PayloadTag = "Payload"; 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. // 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) foreach (var (name, data) in trigger.Components)
{ {
if (!_componentFactory.TryGetRegistration(name, out var registration)) if (!Factory.TryGetRegistration(name, out var registration))
continue; continue;
if (HasComp(uid, registration.Type)) if (HasComp(uid, registration.Type))
continue; continue;
if (_componentFactory.GetComponent(registration.Type) is not Component component) if (Factory.GetComponent(registration.Type) is not Component component)
continue; continue;
var temp = (object) component; var temp = (object) component;

View File

@@ -28,7 +28,6 @@ namespace Content.Server.Polymorph.Systems;
public sealed partial class PolymorphSystem : EntitySystem public sealed partial class PolymorphSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _compFact = default!;
[Dependency] private readonly SharedMapSystem _map = default!; [Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
@@ -213,7 +212,7 @@ public sealed partial class PolymorphSystem : EntitySystem
MakeSentientCommand.MakeSentient(child, EntityManager); MakeSentientCommand.MakeSentient(child, EntityManager);
var polymorphedComp = _compFact.GetComponent<PolymorphedEntityComponent>(); var polymorphedComp = Factory.GetComponent<PolymorphedEntityComponent>();
polymorphedComp.Parent = uid; polymorphedComp.Parent = uid;
polymorphedComp.Configuration = configuration; polymorphedComp.Configuration = configuration;
AddComp(child, polymorphedComp); AddComp(child, polymorphedComp);

View File

@@ -271,7 +271,7 @@ public sealed partial class ShuttleSystem
if (HasComp(grid.Value, compType)) if (HasComp(grid.Value, compType))
continue; continue;
var comp = _factory.GetComponent(compType); var comp = Factory.GetComponent(compType);
AddComp(grid.Value, comp, true); AddComp(grid.Value, comp, true);
} }
} }

View File

@@ -40,7 +40,6 @@ namespace Content.Server.Shuttles.Systems;
public sealed partial class ShuttleSystem : SharedShuttleSystem public sealed partial class ShuttleSystem : SharedShuttleSystem
{ {
[Dependency] private readonly IAdminLogManager _logger = default!; [Dependency] private readonly IAdminLogManager _logger = default!;
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;

View File

@@ -5,8 +5,6 @@ namespace Content.Server.Speech.EntitySystems;
public sealed class AddAccentClothingSystem : EntitySystem public sealed class AddAccentClothingSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _componentFactory = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -19,12 +17,12 @@ public sealed class AddAccentClothingSystem : EntitySystem
private void OnGotEquipped(EntityUid uid, AddAccentClothingComponent component, ref ClothingGotEquippedEvent args) private void OnGotEquipped(EntityUid uid, AddAccentClothingComponent component, ref ClothingGotEquippedEvent args)
{ {
// does the user already has this accent? // 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)) if (HasComp(args.Wearer, componentType))
return; return;
// add accent to the user // add accent to the user
var accentComponent = (Component) _componentFactory.GetComponent(componentType); var accentComponent = (Component) Factory.GetComponent(componentType);
AddComp(args.Wearer, accentComponent); AddComp(args.Wearer, accentComponent);
// snowflake case for replacement accent // snowflake case for replacement accent
@@ -40,11 +38,8 @@ public sealed class AddAccentClothingSystem : EntitySystem
return; return;
// try to remove accent // try to remove accent
var componentType = _componentFactory.GetRegistration(component.Accent).Type; var componentType = Factory.GetRegistration(component.Accent).Type;
if (EntityManager.HasComponent(args.Wearer, componentType)) EntityManager.RemoveComponent(args.Wearer, componentType);
{
EntityManager.RemoveComponent(args.Wearer, componentType);
}
component.IsActive = false; component.IsActive = false;
} }

View File

@@ -19,7 +19,6 @@ namespace Content.Server.UserInterface;
public sealed class StatValuesCommand : IConsoleCommand public sealed class StatValuesCommand : IConsoleCommand
{ {
[Dependency] private readonly EuiManager _eui = default!; [Dependency] private readonly EuiManager _eui = default!;
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
@@ -174,7 +173,7 @@ public sealed class StatValuesCommand : IConsoleCommand
private StatValuesEuiMessage GetMelee() private StatValuesEuiMessage GetMelee()
{ {
var values = new List<string[]>(); var values = new List<string[]>();
var meleeName = _factory.GetComponentName(typeof(MeleeWeaponComponent)); var meleeName = _entManager.ComponentFactory.GetComponentName<MeleeWeaponComponent>();
foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>()) foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
{ {
@@ -257,7 +256,7 @@ public sealed class StatValuesCommand : IConsoleCommand
private StatValuesEuiMessage GetDrawRateMessage() private StatValuesEuiMessage GetDrawRateMessage()
{ {
var values = new List<string[]>(); var values = new List<string[]>();
var powerName = _factory.GetComponentName(typeof(ApcPowerReceiverComponent)); var powerName = _entManager.ComponentFactory.GetComponentName<ApcPowerReceiverComponent>();
foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>()) foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
{ {

View File

@@ -96,7 +96,7 @@ public sealed partial class GunSystem
if (component is ProjectileBatteryAmmoProviderComponent battery) if (component is ProjectileBatteryAmmoProviderComponent battery)
{ {
if (ProtoManager.Index<EntityPrototype>(battery.Prototype).Components 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; var p = (ProjectileComponent) projectile.Component;

View File

@@ -33,7 +33,7 @@ public sealed partial class GunSystem
return null; return null;
if (entityProto.Components if (entityProto.Components
.TryGetValue(_factory.GetComponentName(typeof(ProjectileComponent)), out var projectile)) .TryGetValue(Factory.GetComponentName<ProjectileComponent>(), out var projectile))
{ {
var p = (ProjectileComponent) projectile.Component; var p = (ProjectileComponent) projectile.Component;

View File

@@ -28,14 +28,11 @@ namespace Content.Server.Weapons.Ranged.Systems;
public sealed partial class GunSystem : SharedGunSystem 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 DamageExamineSystem _damageExamine = default!;
[Dependency] private readonly PricingSystem _pricing = default!; [Dependency] private readonly PricingSystem _pricing = default!;
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!; [Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
[Dependency] private readonly SharedStaminaSystem _stamina = default!; [Dependency] private readonly SharedStaminaSystem _stamina = default!;
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly PowerCellSystem _powerCell = default!;
[Dependency] private readonly SharedMapSystem _map = default!; [Dependency] private readonly SharedMapSystem _map = default!;
private const float DamagePitchVariation = 0.05f; private const float DamagePitchVariation = 0.05f;

View File

@@ -13,7 +13,6 @@ namespace Content.Shared.Clothing.EntitySystems;
public abstract class SharedChameleonClothingSystem : EntitySystem public abstract class SharedChameleonClothingSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ClothingSystem _clothingSystem = default!; [Dependency] private readonly ClothingSystem _clothingSystem = default!;
[Dependency] private readonly ContrabandSystem _contraband = default!; [Dependency] private readonly ContrabandSystem _contraband = default!;
@@ -66,7 +65,7 @@ public abstract class SharedChameleonClothingSystem : EntitySystem
// item sprite logic // item sprite logic
if (TryComp(uid, out ItemComponent? item) && if (TryComp(uid, out ItemComponent? item) &&
proto.TryGetComponent(out ItemComponent? otherItem, _factory)) proto.TryGetComponent(out ItemComponent? otherItem, Factory))
{ {
_itemSystem.CopyVisuals(uid, otherItem, item); _itemSystem.CopyVisuals(uid, otherItem, item);
} }
@@ -126,7 +125,7 @@ public abstract class SharedChameleonClothingSystem : EntitySystem
return false; return false;
// check if it is marked as valid chameleon target // 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; return false;
if (requiredTag != null && !_tag.HasTag(tag, requiredTag)) if (requiredTag != null && !_tag.HasTag(tag, requiredTag))

View File

@@ -40,7 +40,6 @@ namespace Content.Shared.Cuffs
// TODO remove all the IsServer() checks. // TODO remove all the IsServer() checks.
public abstract partial class SharedCuffableSystem : EntitySystem public abstract partial class SharedCuffableSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly INetManager _net = default!; [Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!; [Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
@@ -146,7 +145,7 @@ namespace Content.Shared.Cuffs
private void OnStartup(EntityUid uid, CuffableComponent component, ComponentInit args) 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) private void OnRejuvenate(EntityUid uid, CuffableComponent component, RejuvenateEvent args)

View File

@@ -6,8 +6,6 @@ namespace Content.Shared.Examine
{ {
public abstract partial class ExamineSystemShared : EntitySystem public abstract partial class ExamineSystemShared : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _componentFactory = default!;
public const string DefaultIconTexture = "/Textures/Interface/examine-star.png"; public const string DefaultIconTexture = "/Textures/Interface/examine-star.png";
public override void Initialize() public override void Initialize()
@@ -55,7 +53,7 @@ namespace Content.Shared.Examine
{ {
foreach (var comp in components) foreach (var comp in components)
{ {
if (!_componentFactory.TryGetRegistration(comp, out var componentRegistration)) if (!Factory.TryGetRegistration(comp, out var componentRegistration))
continue; continue;
if (!HasComp(uid, componentRegistration.Type)) if (!HasComp(uid, componentRegistration.Type))
@@ -117,7 +115,7 @@ namespace Content.Shared.Examine
if (TryComp<GroupExamineComponent>(verbsEvent.Target, out var groupExamine)) if (TryComp<GroupExamineComponent>(verbsEvent.Target, out var groupExamine))
{ {
// Make sure we have the component name as a string // 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) foreach (var examineGroup in groupExamine.Group)
{ {
@@ -177,7 +175,7 @@ namespace Content.Shared.Examine
/// </summary> /// </summary>
public void AddDetailedExamineVerb(GetVerbsEvent<ExamineVerb> verbsEvent, Component component, FormattedMessage message, string verbText, string iconTexture = DefaultIconTexture, string hoverMessage = "", bool isHoverExamine = false) 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); AddDetailedExamineVerb(verbsEvent, component, new ExamineEntry(componentName, 0f, message), verbText, iconTexture, hoverMessage, isHoverExamine);
} }

View File

@@ -43,7 +43,6 @@ namespace Content.Shared.Magic;
public abstract class SharedMagicSystem : EntitySystem public abstract class SharedMagicSystem : EntitySystem
{ {
[Dependency] private readonly ISerializationManager _seriMan = default!; [Dependency] private readonly ISerializationManager _seriMan = default!;
[Dependency] private readonly IComponentFactory _compFact = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!; [Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
@@ -356,7 +355,7 @@ public abstract class SharedMagicSystem : EntitySystem
if (HasComp(target, data.Component.GetType())) if (HasComp(target, data.Component.GetType()))
continue; continue;
var component = (Component)_compFact.GetComponent(name); var component = (Component)Factory.GetComponent(name);
var temp = (object)component; var temp = (object)component;
_seriMan.CopyTo(data.Component, ref temp); _seriMan.CopyTo(data.Component, ref temp);
EntityManager.AddComponent(target, (Component)temp!); EntityManager.AddComponent(target, (Component)temp!);
@@ -367,7 +366,7 @@ public abstract class SharedMagicSystem : EntitySystem
{ {
foreach (var toRemove in comps) foreach (var toRemove in comps)
{ {
if (_compFact.TryGetRegistration(toRemove, out var registration)) if (Factory.TryGetRegistration(toRemove, out var registration))
RemComp(target, registration.Type); RemComp(target, registration.Type);
} }
} }

View File

@@ -11,7 +11,6 @@ namespace Content.Shared.StatusEffect
public sealed class StatusEffectsSystem : EntitySystem public sealed class StatusEffectsSystem : EntitySystem
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!;
private List<EntityUid> _toRemove = new(); private List<EntityUid> _toRemove = new();
@@ -119,7 +118,7 @@ namespace Content.Shared.StatusEffect
return true; return true;
EntityManager.AddComponent<T>(uid); EntityManager.AddComponent<T>(uid);
status.ActiveEffects[key].RelevantComponent = _componentFactory.GetComponentName<T>(); status.ActiveEffects[key].RelevantComponent = Factory.GetComponentName<T>();
return true; return true;
} }
@@ -133,9 +132,9 @@ namespace Content.Shared.StatusEffect
if (TryAddStatusEffect(uid, key, time, refresh, status)) if (TryAddStatusEffect(uid, key, time, refresh, status))
{ {
// If they already have the comp, we just won't bother updating anything. // 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); EntityManager.AddComponent(uid, newComponent);
status.ActiveEffects[key].RelevantComponent = component; 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... // There are cases where a status effect component might be server-only, so TryGetRegistration...
if (remComp if (remComp
&& state.RelevantComponent != null && state.RelevantComponent != null
&& _componentFactory.TryGetRegistration(state.RelevantComponent, out var registration)) && Factory.TryGetRegistration(state.RelevantComponent, out var registration))
{ {
var type = registration.Type; var type = registration.Type;
EntityManager.RemoveComponent(uid, type); EntityManager.RemoveComponent(uid, type);

View File

@@ -6,7 +6,6 @@ namespace Content.Shared.Whitelist;
public sealed class EntityWhitelistSystem : EntitySystem public sealed class EntityWhitelistSystem : EntitySystem
{ {
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly TagSystem _tag = default!;
private EntityQuery<ItemComponent> _itemQuery; private EntityQuery<ItemComponent> _itemQuery;
@@ -178,8 +177,8 @@ public sealed class EntityWhitelistSystem : EntitySystem
foreach (var name in input) foreach (var name in input)
{ {
var availability = _factory.GetComponentAvailability(name); var availability = Factory.GetComponentAvailability(name);
if (_factory.TryGetRegistration(name, out var registration) if (Factory.TryGetRegistration(name, out var registration)
&& availability == ComponentAvailability.Available) && availability == ComponentAvailability.Available)
{ {
list.Add(registration); list.Add(registration);