Replace obsolete EntityWhitelist IsValid usages (#28465)

* Replace obsolete whitelist is valid with whitelist system

* Consistency

* Fix logic

* Bork

* I figured out how to get whitelists on the client lol

* test fail

* woops

* HELP ME FUNCTIONS

* Fix errors

* simplify

---------

Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya
2024-06-01 20:10:24 -07:00
committed by GitHub
parent dce68e48e8
commit d6ba166d3b
31 changed files with 186 additions and 56 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.ActionBlocker;
using Content.Shared.ActionBlocker;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
@@ -7,6 +7,7 @@ using Content.Shared.Inventory;
using Content.Shared.Popups;
using Content.Shared.Storage;
using Content.Shared.Storage.EntitySystems;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
@@ -25,6 +26,7 @@ public sealed class SmartEquipSystem : EntitySystem
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <inheritdoc/>
public override void Initialize()
@@ -182,7 +184,7 @@ public sealed class SmartEquipSystem : EntitySystem
foreach (var slot in slots.Slots.Values)
{
if (!slot.HasItem
&& (slot.Whitelist?.IsValid(handItem.Value, EntityManager) ?? true)
&& _whitelistSystem.IsWhitelistPassOrNull(slot.Whitelist, handItem.Value)
&& slot.Priority > (toInsertTo?.Priority ?? int.MinValue))
{
toInsertTo = slot;