Files
OldThink/Content.Server/Xenoarchaeology/Equipment/Systems/SuppressArtifactContainerSystem.cs
Nemanja 2a83a9bc17 [Sci] Non-destructive XenoArch Research (#15398)
* Non-destructive XenoArch research

* nerf the price

* Points -> Extract
2023-04-16 23:57:21 -06:00

34 lines
1.2 KiB
C#

using Content.Server.Xenoarchaeology.Equipment.Components;
using Content.Server.Xenoarchaeology.XenoArtifacts;
using Robust.Shared.Containers;
namespace Content.Server.Xenoarchaeology.Equipment.Systems;
public sealed class SuppressArtifactContainerSystem : EntitySystem
{
[Dependency] private readonly ArtifactSystem _artifact = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SuppressArtifactContainerComponent, EntInsertedIntoContainerMessage>(OnInserted);
SubscribeLocalEvent<SuppressArtifactContainerComponent, EntRemovedFromContainerMessage>(OnRemoved);
}
private void OnInserted(EntityUid uid, SuppressArtifactContainerComponent component, EntInsertedIntoContainerMessage args)
{
if (!TryComp<ArtifactComponent>(args.Entity, out var artifact))
return;
_artifact.SetIsSuppressed(args.Entity, true, artifact);
}
private void OnRemoved(EntityUid uid, SuppressArtifactContainerComponent component, EntRemovedFromContainerMessage args)
{
if (!TryComp<ArtifactComponent>(args.Entity, out var artifact))
return;
_artifact.SetIsSuppressed(args.Entity, false, artifact);
}
}