* flame creation spell backend * flame creation visuals * flame creation spell visual * tweak * some tweaks * ice dagger spell * move spells to rings * Update ring.yml * fix server crash
32 lines
967 B
C#
32 lines
967 B
C#
using Content.Shared.Hands.EntitySystems;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared._CP14.MagicSpell.Spells;
|
|
|
|
public sealed partial class CP14SpellSpawnInHandEntity : CP14SpellEffect
|
|
{
|
|
[DataField]
|
|
public List<EntProtoId> Spawns = new();
|
|
|
|
[DataField]
|
|
public bool DeleteIfCantPickup = false;
|
|
|
|
public override void Effect(EntityManager entManager, CP14SpellEffectBaseArgs args)
|
|
{
|
|
if (args.Target is null)
|
|
return;
|
|
|
|
if (!entManager.TryGetComponent<TransformComponent>(args.Target.Value, out var transformComponent))
|
|
return;
|
|
|
|
var handSystem = entManager.System<SharedHandsSystem>();
|
|
|
|
foreach (var spawn in Spawns)
|
|
{
|
|
var item = entManager.SpawnAtPosition(spawn, transformComponent.Coordinates);
|
|
if (!handSystem.TryPickupAnyHand(args.Target.Value, item) && DeleteIfCantPickup)
|
|
entManager.QueueDeleteEntity(item);
|
|
}
|
|
}
|
|
}
|