JauntSystem.cs 741 B

1234567891011121314151617181920212223242526
  1. using Content.Shared.Actions;
  2. namespace Content.Shared.Jaunt;
  3. public sealed class JauntSystem : EntitySystem
  4. {
  5. [Dependency] private readonly SharedActionsSystem _actions = default!;
  6. public override void Initialize()
  7. {
  8. base.Initialize();
  9. SubscribeLocalEvent<JauntComponent, MapInitEvent>(OnInit);
  10. SubscribeLocalEvent<JauntComponent, ComponentShutdown>(OnShutdown);
  11. }
  12. private void OnInit(Entity<JauntComponent> ent, ref MapInitEvent args)
  13. {
  14. _actions.AddAction(ent.Owner, ref ent.Comp.Action, ent.Comp.JauntAction);
  15. }
  16. private void OnShutdown(Entity<JauntComponent> ent, ref ComponentShutdown args)
  17. {
  18. _actions.RemoveAction(ent.Owner, ent.Comp.Action);
  19. }
  20. }