init
This commit is contained in:
20
Content.Server/_CP14/ModularCraft/Modifiers/AddNewSlots.cs
Normal file
20
Content.Server/_CP14/ModularCraft/Modifiers/AddNewSlots.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user