Skip to content

Commit

Permalink
Suit Storage Whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Errant-4 committed Jun 22, 2024
1 parent 7252a92 commit b1f5035
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Content.Shared/Armor/AllowSuitStorageComponent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Content.Shared.Whitelist;

namespace Content.Shared.Armor;

/// <summary>
Expand All @@ -7,4 +9,13 @@ namespace Content.Shared.Armor;
public sealed partial class AllowSuitStorageComponent : Component
{

[DataField]
public EntityWhitelist Whitelist = new()
{
Components = new[]
{
"Item"
}
};

}
8 changes: 8 additions & 0 deletions Content.Shared/Inventory/InventorySystem.Equip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,17 @@ public bool CanEquip(EntityUid actor, EntityUid target, EntityUid itemUid, strin
return false;

if (slotDefinition.DependsOnComponents is { } componentRegistry)
{
foreach (var (_, entry) in componentRegistry)
{
if (!HasComp(slotEntity, entry.Component.GetType()))
return false;

if (TryComp<AllowSuitStorageComponent>(slotEntity, out var comp) &&
!_whitelistSystem.IsWhitelistPass(comp.Whitelist, itemUid))
return false;
}
}
}

var fittingInPocket = slotDefinition.SlotFlags.HasFlag(SlotFlags.POCKET) &&
Expand Down

0 comments on commit b1f5035

Please sign in to comment.