This commit is contained in:
comasqw
2024-12-02 12:31:07 +04:00
parent bb43b37fd8
commit 81dd06ac2c
73 changed files with 676 additions and 18 deletions

View File

@@ -0,0 +1,20 @@
using Content.Shared._CP14.ModularCraft.Prototypes;
using Content.Shared._CP14.ModularCraft;
using Content.Shared._CP14.ModularCraft.Components;
using Robust.Shared.Prototypes;
namespace Content.Server._CP14.ModularCraft.Modifiers;
public sealed partial class AddNewSlots : CP14ModularCraftModifier
{
[DataField]
public List<ProtoId<CP14ModularCraftSlotPrototype>> Slots;
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
{
foreach (var slot in Slots)
{
start.Comp.FreeSlots.Add(slot);
}
}
}

View File

@@ -0,0 +1,27 @@
using System.Linq;
using Content.Shared._CP14.ModularCraft;
using Content.Shared._CP14.ModularCraft.Components;
using Content.Shared.Item;
using Content.Shared._CP14.MagicSpellStorage;
using Robust.Shared.Prototypes;
namespace Content.Server._CP14.ModularCraft.Modifiers;
public sealed partial class AddSpellsToSpellStorage : CP14ModularCraftModifier
{
[DataField]
public List<EntProtoId> Spells;
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
{
if (!entManager.TryGetComponent<CP14SpellStorageComponent>(start, out var storageComp))
return;
var spellStorageSystem = entManager.System<CP14SpellStorageSystem>();
foreach (var spell in Spells)
{
spellStorageSystem.TryAddSpellToStorage((start.Owner, storageComp), spell);
}
}
}