From 72a68c06e4393421b504065cdce44f8a4cc08bfb Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Fri, 3 Dec 2021 12:08:27 +0100 Subject: [PATCH] Inline one HasComponent overload --- Content.IntegrationTests/Tests/EntityTest.cs | 4 ++-- .../Construction/Components/MachineFrameComponent.cs | 7 ++++--- Content.Server/Construction/Conditions/ComponentInTile.cs | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Content.IntegrationTests/Tests/EntityTest.cs b/Content.IntegrationTests/Tests/EntityTest.cs index f8a18b3f56..7f37a60f63 100644 --- a/Content.IntegrationTests/Tests/EntityTest.cs +++ b/Content.IntegrationTests/Tests/EntityTest.cs @@ -177,7 +177,7 @@ namespace Content.IntegrationTests.Tests // The component may already exist if it is a mandatory component // such as MetaData or Transform - if (entity.HasComponent(type)) + if (IoCManager.Resolve().HasComponent(entity.Uid, type)) { continue; } @@ -309,7 +309,7 @@ namespace Content.IntegrationTests.Tests var component = (Component) componentFactory.GetComponent(type); // If the entity already has this component, if it was ensured or added by another - if (entity.HasComponent(component.GetType())) + if (IoCManager.Resolve().HasComponent(entity.Uid, component.GetType())) { continue; } diff --git a/Content.Server/Construction/Components/MachineFrameComponent.cs b/Content.Server/Construction/Components/MachineFrameComponent.cs index 0eea48f91d..f0a28a591b 100644 --- a/Content.Server/Construction/Components/MachineFrameComponent.cs +++ b/Content.Server/Construction/Components/MachineFrameComponent.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading.Tasks; using Content.Server.Stack; using Content.Shared.Construction; @@ -228,7 +229,7 @@ namespace Content.Server.Construction.Components { var registration = _componentFactory.GetRegistration(compName); - if (!part.HasComponent(registration.Type)) + if (!IoCManager.Resolve().HasComponent(part.Uid, registration.Type)) continue; if (!_componentProgress.ContainsKey(compName)) @@ -332,7 +333,7 @@ namespace Content.Server.Construction.Components var registration = _componentFactory.GetRegistration(compName); - if (!eventArgs.Using.HasComponent(registration.Type)) + if (!IoCManager.Resolve().HasComponent(eventArgs.Using.Uid, registration.Type)) continue; if (!eventArgs.Using.TryRemoveFromContainer() || !_partContainer.Insert(eventArgs.Using)) continue; diff --git a/Content.Server/Construction/Conditions/ComponentInTile.cs b/Content.Server/Construction/Conditions/ComponentInTile.cs index 05fb8674ce..0c14f7ad52 100644 --- a/Content.Server/Construction/Conditions/ComponentInTile.cs +++ b/Content.Server/Construction/Conditions/ComponentInTile.cs @@ -56,7 +56,7 @@ namespace Content.Server.Construction.Conditions foreach (var ent in entities) { - if (ent.HasComponent(type)) + if (IoCManager.Resolve().HasComponent(ent.Uid, type)) return HasEntity; }