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:
@@ -4,6 +4,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -15,6 +16,7 @@ public sealed class PickRandomSystem : EntitySystem
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -30,7 +32,7 @@ public sealed class PickRandomSystem : EntitySystem
|
||||
|
||||
var user = args.User;
|
||||
|
||||
var enabled = storage.Container.ContainedEntities.Any(item => comp.Whitelist?.IsValid(item, EntityManager) ?? true);
|
||||
var enabled = storage.Container.ContainedEntities.Any(item => _whitelistSystem.IsWhitelistPassOrNull(comp.Whitelist, item));
|
||||
|
||||
// alt-click / alt-z to pick an item
|
||||
args.Verbs.Add(new AlternativeVerb
|
||||
@@ -48,7 +50,7 @@ public sealed class PickRandomSystem : EntitySystem
|
||||
|
||||
private void TryPick(EntityUid uid, PickRandomComponent comp, StorageComponent storage, EntityUid user)
|
||||
{
|
||||
var entities = storage.Container.ContainedEntities.Where(item => comp.Whitelist?.IsValid(item, EntityManager) ?? true).ToArray();
|
||||
var entities = storage.Container.ContainedEntities.Where(item => _whitelistSystem.IsWhitelistPassOrNull(comp.Whitelist, item)).ToArray();
|
||||
|
||||
if (!entities.Any())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user