Inline one HasComponent overload

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 12:08:27 +01:00
parent b835bea086
commit 72a68c06e4
3 changed files with 7 additions and 6 deletions

View File

@@ -177,7 +177,7 @@ namespace Content.IntegrationTests.Tests
// The component may already exist if it is a mandatory component // The component may already exist if it is a mandatory component
// such as MetaData or Transform // such as MetaData or Transform
if (entity.HasComponent(type)) if (IoCManager.Resolve<IEntityManager>().HasComponent(entity.Uid, type))
{ {
continue; continue;
} }
@@ -309,7 +309,7 @@ namespace Content.IntegrationTests.Tests
var component = (Component) componentFactory.GetComponent(type); var component = (Component) componentFactory.GetComponent(type);
// If the entity already has this component, if it was ensured or added by another // If the entity already has this component, if it was ensured or added by another
if (entity.HasComponent(component.GetType())) if (IoCManager.Resolve<IEntityManager>().HasComponent(entity.Uid, component.GetType()))
{ {
continue; continue;
} }

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Server.Stack; using Content.Server.Stack;
using Content.Shared.Construction; using Content.Shared.Construction;
@@ -228,7 +229,7 @@ namespace Content.Server.Construction.Components
{ {
var registration = _componentFactory.GetRegistration(compName); var registration = _componentFactory.GetRegistration(compName);
if (!part.HasComponent(registration.Type)) if (!IoCManager.Resolve<IEntityManager>().HasComponent(part.Uid, registration.Type))
continue; continue;
if (!_componentProgress.ContainsKey(compName)) if (!_componentProgress.ContainsKey(compName))
@@ -332,7 +333,7 @@ namespace Content.Server.Construction.Components
var registration = _componentFactory.GetRegistration(compName); var registration = _componentFactory.GetRegistration(compName);
if (!eventArgs.Using.HasComponent(registration.Type)) if (!IoCManager.Resolve<IEntityManager>().HasComponent(eventArgs.Using.Uid, registration.Type))
continue; continue;
if (!eventArgs.Using.TryRemoveFromContainer() || !_partContainer.Insert(eventArgs.Using)) continue; if (!eventArgs.Using.TryRemoveFromContainer() || !_partContainer.Insert(eventArgs.Using)) continue;

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Construction.Conditions
foreach (var ent in entities) foreach (var ent in entities)
{ {
if (ent.HasComponent(type)) if (IoCManager.Resolve<IEntityManager>().HasComponent(ent.Uid, type))
return HasEntity; return HasEntity;
} }