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

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