whitelist and blacklist support for inventory slots (#11766)

This commit is contained in:
Rane
2022-10-08 13:53:34 -04:00
committed by GitHub
parent 5ba36dad25
commit ddb10d8b99
2 changed files with 24 additions and 1 deletions

View File

@@ -281,6 +281,18 @@ public abstract partial class InventorySystem
return false;
}
if (slotDefinition.Whitelist != null && !slotDefinition.Whitelist.IsValid(itemUid))
{
reason = "inventory-component-can-equip-does-not-fit";
return false;
}
if (slotDefinition.Blacklist != null && slotDefinition.Blacklist.IsValid(itemUid))
{
reason = "inventory-component-can-equip-does-not-fit";
return false;
}
var attemptEvent = new IsEquippingAttemptEvent(actor, target, itemUid, slotDefinition);
RaiseLocalEvent(target, attemptEvent, true);
if (attemptEvent.Cancelled)