InstrumentComponent.cs 994 B

12345678910111213141516171819202122232425262728
  1. using Content.Server.UserInterface;
  2. using Content.Shared.Instruments;
  3. using Robust.Shared.Player;
  4. using ActivatableUIComponent = Content.Shared.UserInterface.ActivatableUIComponent;
  5. namespace Content.Server.Instruments;
  6. [RegisterComponent]
  7. public sealed partial class InstrumentComponent : SharedInstrumentComponent
  8. {
  9. [Dependency] private readonly IEntityManager _entMan = default!;
  10. [ViewVariables] public float Timer = 0f;
  11. [ViewVariables] public int BatchesDropped = 0;
  12. [ViewVariables] public int LaggedBatches = 0;
  13. [ViewVariables] public int MidiEventCount = 0;
  14. [ViewVariables] public uint LastSequencerTick = 0;
  15. // TODO Instruments: Make this ECS
  16. public EntityUid? InstrumentPlayer =>
  17. _entMan.GetComponentOrNull<ActivatableUIComponent>(Owner)?.CurrentSingleUser
  18. ?? _entMan.GetComponentOrNull<ActorComponent>(Owner)?.PlayerSession.AttachedEntity;
  19. }
  20. [RegisterComponent]
  21. public sealed partial class ActiveInstrumentComponent : Component
  22. {
  23. }