Fix EntityWhitelist not taking into account ignored components
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
|
using Content.Shared.Wires;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -50,13 +51,16 @@ namespace Content.Shared.Whitelist
|
|||||||
_registrations = new List<IComponentRegistration>();
|
_registrations = new List<IComponentRegistration>();
|
||||||
foreach (var name in Components)
|
foreach (var name in Components)
|
||||||
{
|
{
|
||||||
if (!compfact.TryGetRegistration(name, out var registration))
|
var availability = compfact.GetComponentAvailability(name);
|
||||||
|
if (compfact.TryGetRegistration(name, out var registration)
|
||||||
|
&& availability == ComponentAvailability.Available)
|
||||||
{
|
{
|
||||||
Logger.Warning($"Invalid component name {name} passed to EntityWhitelist!");
|
_registrations.Add(registration);
|
||||||
continue;
|
}
|
||||||
|
else if (availability == ComponentAvailability.Unknown)
|
||||||
|
{
|
||||||
|
Logger.Warning($"Unknown component name {name} passed to EntityWhitelist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
_registrations.Add(registration);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +79,7 @@ namespace Content.Shared.Whitelist
|
|||||||
{
|
{
|
||||||
foreach (var reg in _registrations)
|
foreach (var reg in _registrations)
|
||||||
{
|
{
|
||||||
if (entity.TryGetComponent(reg.Type, out _))
|
if (entity.HasComponent(reg.Type))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user