Artifact container (#7822)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Equipment.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Suppress artifact activation, when entity is placed inside this container.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class SuppressArtifactContainerComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Equipment.Components;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Equipment.Systems;
|
||||
|
||||
public sealed class SuppressArtifactContainerSystem : EntitySystem
|
||||
{
|
||||
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(args.Entity, out ArtifactComponent? artifact))
|
||||
return;
|
||||
|
||||
artifact.IsSuppressed = true;
|
||||
}
|
||||
|
||||
private void OnRemoved(EntityUid uid, SuppressArtifactContainerComponent component, EntRemovedFromContainerMessage args)
|
||||
{
|
||||
if (!TryComp(args.Entity, out ArtifactComponent? artifact))
|
||||
return;
|
||||
|
||||
artifact.IsSuppressed = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user