EntityWhitelist uses EntityUid

This commit is contained in:
Vera Aguilera Puerto
2021-11-09 13:08:09 +01:00
parent 5d66a08ac9
commit 1f9e1c033f
8 changed files with 20 additions and 18 deletions

View File

@@ -67,11 +67,13 @@ namespace Content.Shared.Whitelist
/// <summary>
/// Returns whether a given entity fits the whitelist.
/// </summary>
public bool IsValid(IEntity entity)
public bool IsValid(EntityUid uid, IEntityManager? entityManager = null)
{
if (Tags != null)
entityManager ??= IoCManager.Resolve<IEntityManager>();
if (Tags != null && entityManager.TryGetComponent(uid, out TagComponent? tags))
{
if (entity.HasAnyTag(Tags))
if (tags.HasAnyTag(Tags))
return true;
}
@@ -79,7 +81,7 @@ namespace Content.Shared.Whitelist
{
foreach (var reg in _registrations)
{
if (entity.HasComponent(reg.Type))
if (entityManager.HasComponent(uid, reg.Type))
return true;
}
}