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

@@ -2,6 +2,7 @@ using System.Linq;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Components;
using Content.Shared.Stacks;
using Content.Shared.Whitelist;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
@@ -17,6 +18,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
/// <summary>
/// Default volume for a sheet if the material's entity prototype has no material composition.
@@ -121,7 +123,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
if (!CanTakeVolume(uid, volume, component))
return false;
if (component.MaterialWhiteList != null && !component.MaterialWhiteList.Contains(materialId))
if (component.MaterialWhiteList == null ? false : component.MaterialWhiteList.Contains(materialId))
return false;
var amount = component.Storage.GetValueOrDefault(materialId);
@@ -239,7 +241,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
if (!Resolve(toInsert, ref material, ref composition, false))
return false;
if (storage.Whitelist?.IsValid(toInsert) == false)
if (_whitelistSystem.IsWhitelistFail(storage.Whitelist, toInsert))
return false;
if (HasComp<UnremoveableComponent>(toInsert))