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

@@ -9,6 +9,7 @@ using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Popups;
using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
@@ -31,6 +32,7 @@ namespace Content.Shared.Containers.ItemSlots
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize()
{
@@ -266,8 +268,7 @@ namespace Content.Shared.Containers.ItemSlots
if (slot.ContainerSlot == null)
return false;
if ((!slot.Whitelist?.IsValid(usedUid) ?? false) ||
(slot.Blacklist?.IsValid(usedUid) ?? false))
if (_whitelistSystem.IsWhitelistFail(slot.Whitelist, usedUid) || _whitelistSystem.IsBlacklistPass(slot.Blacklist, usedUid))
{
if (popup.HasValue && slot.WhitelistFailPopup.HasValue)
_popupSystem.PopupClient(Loc.GetString(slot.WhitelistFailPopup), uid, popup.Value);