CompFactory updates (#37559)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user