Spell T0 traits, recategorize magic (#540)

* move to gurps magic types

* spell traits, categorize spells

* Update TraitSystem.cs

* magic spells item provider

* Update twoHandedStaffs.yml

* Update CP14MagicManacostModifySystem.cs

* Update CP14SpellStorageSystem.cs
This commit is contained in:
Ed
2024-11-06 18:02:37 +03:00
committed by GitHub
parent 0f091b4cdf
commit 7e4fb90e02
31 changed files with 202 additions and 86 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Clothing.Components;
using Content.Shared.Hands;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Mind;
using Robust.Shared.Network;
namespace Content.Shared._CP14.MagicSpellStorage;
@@ -18,10 +19,12 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly CP14SharedMagicAttuningSystem _attuning = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly INetManager _net = default!;
public override void Initialize()
{
SubscribeLocalEvent<CP14SpellStorageComponent, MapInitEvent>(OnMagicStorageInit);
SubscribeLocalEvent<CP14SpellStorageComponent, ComponentShutdown>(OnMagicStorageShutdown);
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, GotEquippedHandEvent>(OnEquippedHand);
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, AddedAttuneToMindEvent>(OnHandAddedAttune);
@@ -38,16 +41,33 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
/// </summary>
private void OnMagicStorageInit(Entity<CP14SpellStorageComponent> mStorage, ref MapInitEvent args)
{
if (_net.IsClient)
return;
foreach (var spell in mStorage.Comp.Spells)
{
var spellEnt = _actionContainer.AddAction(mStorage, spell);
if (spellEnt is null)
continue;
var provided = EntityManager.EnsureComponent<CP14ProvidedBySpellStorageComponent>(spellEnt.Value);
provided.SpellStorage = mStorage;
mStorage.Comp.SpellEntities.Add(spellEnt.Value);
}
}
private void OnMagicStorageShutdown(Entity<CP14SpellStorageComponent> mStorage, ref ComponentShutdown args)
{
if (_net.IsClient)
return;
foreach (var spell in mStorage.Comp.SpellEntities)
{
QueueDel(spell);
}
}
private void OnEquippedHand(Entity<CP14SpellStorageAccessHoldingComponent> ent, ref GotEquippedHandEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))