using Content.Shared.Inventory;
using Robust.Shared.Prototypes;
namespace Content.Shared.EntityEffects.Effects.EntitySpawning;
///
/// Spawns an entity of a given prototype in a specified inventory slot owned by this entity.
/// Fails if it cannot spawn the entity in the given slot.
///
///
public sealed partial class SpawnEntityInInventoryEntityEffectSystem : EntityEffectSystem
{
[Dependency] private readonly InventorySystem _inventory = default!;
protected override void Effect(Entity entity, ref EntityEffectEvent args)
{
_inventory.SpawnItemInSlot(entity, args.Effect.Slot, args.Effect.Entity);
}
}
///
public sealed partial class SpawnEntityInInventory : EntityEffectBase
{
///
/// Name of the slot we're spawning the item into.
///
[DataField(required: true)]
public string Slot = string.Empty; // Rider is drunk and keeps yelling at me to fill this out or make required: true but, it is required true so it's just being an asshole.
///
/// Prototype ID of item to spawn.
///
[DataField(required: true)]
public EntProtoId Entity;
}