Files
crystall-punk-14/Content.Shared/_CP14/NightVision/CP14SharedNightVisionSystem.cs
Ed 52e6e9b28f Carcat night vision (#1046)
* carcat night vision

* Update nightVision.yml
2025-03-21 16:53:59 +03:00

29 lines
901 B
C#

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 { }