Signed-off-by: pacable <igor.mamaev1@gmail.com> Co-authored-by: pacable <igor.mamaev1@gmail.com> Co-authored-by: Babaev <129369024+babaevlsdd@users.noreply.github.com>
30 lines
949 B
C#
30 lines
949 B
C#
using Content.Shared._Sunrise.BloodCult.Components;
|
|
using Content.Shared.Interaction;
|
|
|
|
namespace Content.Server._Sunrise.BloodCult.Structures;
|
|
|
|
public sealed class RunicGirderSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly EntityManager _entMan = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<RunicGirderComponent, AfterInteractUsingEvent>(OnInteract);
|
|
}
|
|
|
|
private void OnInteract(EntityUid uid, RunicGirderComponent component, AfterInteractUsingEvent args)
|
|
{
|
|
if (!HasComp<BloodCultistComponent>(args.User))
|
|
return;
|
|
if (MetaData(args.Used).EntityPrototype?.ID != component.UsedItemID)
|
|
return;
|
|
if (args.Target == null)
|
|
return;
|
|
|
|
var pos = Transform(args.Target.Value).Coordinates;
|
|
_entMan.DeleteEntity(args.Target.Value);
|
|
_entMan.SpawnEntity(component.DropItemID, pos);
|
|
}
|
|
}
|