From 1ebe48978efc0fb90903b517a997d60679b83952 Mon Sep 17 00:00:00 2001 From: FN <37689533+FireNameFN@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:44:07 +0700 Subject: [PATCH] Fix (#503) --- .../CP14SpellStorageSystem.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs b/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs index f65d3bd353..1dcdf4fbba 100644 --- a/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs +++ b/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs @@ -1,6 +1,7 @@ using Content.Shared._CP14.MagicAttuning; using Content.Shared.Actions; using Content.Shared.Clothing; +using Content.Shared.Clothing.Components; using Content.Shared.Hands; using Content.Shared.Hands.EntitySystems; using Content.Shared.Mind; @@ -25,6 +26,7 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem SubscribeLocalEvent(OnEquippedHand); SubscribeLocalEvent(OnHandAddedAttune); + SubscribeLocalEvent(OnClothingAddedAttune); SubscribeLocalEvent(OnClothingEquipped); SubscribeLocalEvent(OnClothingUnequipped); @@ -68,6 +70,23 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem TryGrantAccess((ent, spellStorage), args.User.Value); } + private void OnClothingAddedAttune(Entity ent, ref AddedAttuneToMindEvent args) + { + if (!TryComp(ent, out var spellStorage)) + return; + + if (args.User is null) + return; + + if (!TryComp(ent, out var clothing)) + return; + + if (clothing.InSlot is null || Transform(ent).ParentUid != args.User) + return; + + TryGrantAccess((ent, spellStorage), args.User.Value); + } + private void OnClothingEquipped(Entity ent, ref ClothingGotEquippedEvent args) { if (!TryComp(ent, out var spellStorage))