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:
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -16,6 +17,8 @@ public sealed class MagnetPickupSystem : EntitySystem
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly SharedStorageSystem _storage = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||
|
||||
|
||||
private static readonly TimeSpan ScanDelay = TimeSpan.FromSeconds(1);
|
||||
|
||||
@@ -63,7 +66,7 @@ public sealed class MagnetPickupSystem : EntitySystem
|
||||
|
||||
foreach (var near in _lookup.GetEntitiesInRange(uid, comp.Range, LookupFlags.Dynamic | LookupFlags.Sundries))
|
||||
{
|
||||
if (storage.Whitelist?.IsValid(near, EntityManager) == false)
|
||||
if (_whitelistSystem.IsWhitelistFail(storage.Whitelist, near))
|
||||
continue;
|
||||
|
||||
if (!_physicsQuery.TryGetComponent(near, out var physics) || physics.BodyStatus != BodyStatus.OnGround)
|
||||
|
||||
@@ -15,6 +15,7 @@ using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Tools.Systems;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Wall;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -45,6 +46,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
||||
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
||||
[Dependency] private readonly WeldableSystem _weldable = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||
|
||||
public const string ContainerName = "entity_storage";
|
||||
|
||||
@@ -432,7 +434,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
|
||||
var targetIsMob = HasComp<BodyComponent>(toInsert);
|
||||
var storageIsItem = HasComp<ItemComponent>(container);
|
||||
var allowedToEat = component.Whitelist?.IsValid(toInsert) ?? HasComp<ItemComponent>(toInsert);
|
||||
var allowedToEat = component.Whitelist == null ? HasComp<ItemComponent>(toInsert) : _whitelistSystem.IsValid(component.Whitelist, toInsert);
|
||||
|
||||
// BEFORE REPLACING THIS WITH, I.E. A PROPERTY:
|
||||
// Make absolutely 100% sure you have worked out how to stop people ending up in backpacks.
|
||||
|
||||
@@ -55,6 +55,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
||||
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;
|
||||
[Dependency] protected readonly UseDelaySystem UseDelay = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||
|
||||
private EntityQuery<ItemComponent> _itemQuery;
|
||||
private EntityQuery<StackComponent> _stackQuery;
|
||||
@@ -860,13 +861,8 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
if (storageComp.Whitelist?.IsValid(insertEnt, EntityManager) == false)
|
||||
{
|
||||
reason = "comp-storage-invalid-container";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (storageComp.Blacklist?.IsValid(insertEnt, EntityManager) == true)
|
||||
if (_whitelistSystem.IsWhitelistFail(storageComp.Whitelist, insertEnt) ||
|
||||
_whitelistSystem.IsBlacklistPass(storageComp.Blacklist, insertEnt))
|
||||
{
|
||||
reason = "comp-storage-invalid-container";
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user