From dcc9f02e55738b0584569bff5606162443b5a7f3 Mon Sep 17 00:00:00 2001 From: Kara Dinyes Date: Sat, 24 Jul 2021 15:46:44 -0700 Subject: [PATCH] Fix EntityWhitelist not taking into account ignored components --- Content.Shared/Whitelist/EntityWhitelist.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Content.Shared/Whitelist/EntityWhitelist.cs b/Content.Shared/Whitelist/EntityWhitelist.cs index adfe5e1f78..89a6f6ea53 100644 --- a/Content.Shared/Whitelist/EntityWhitelist.cs +++ b/Content.Shared/Whitelist/EntityWhitelist.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Content.Shared.Tag; +using Content.Shared.Wires; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; @@ -50,13 +51,16 @@ namespace Content.Shared.Whitelist _registrations = new List(); 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!"); - continue; + _registrations.Add(registration); + } + 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) { - if (entity.TryGetComponent(reg.Type, out _)) + if (entity.HasComponent(reg.Type)) return true; } }