Files
crystall-punk-14/Content.Shared/_CP14/NightVision/CP14SharedNightVisionSystem.cs

29 lines
901 B
C#
Raw Permalink Normal View History

using Content.Shared.Actions;
namespace Content.Shared._CP14.NightVision;
public abstract class CP14SharedNightVisionSystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _actions = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CP14NightVisionComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<CP14NightVisionComponent, ComponentRemove>(OnRemove);
}
private void OnMapInit(Entity<CP14NightVisionComponent> ent, ref MapInitEvent args)
{
_actions.AddAction(ent, ref ent.Comp.ActionEntity, ent.Comp.ActionPrototype);
}
protected virtual void OnRemove(Entity<CP14NightVisionComponent> ent, ref ComponentRemove args)
{
_actions.RemoveAction(ent, ent.Comp.ActionEntity);
}
}
public sealed partial class CP14ToggleNightVisionEvent : InstantActionEvent { }