2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.UserInterface;
|
|
|
|
|
using Content.Shared.Instruments;
|
2019-11-25 00:11:47 +01:00
|
|
|
using Robust.Server.GameObjects;
|
2020-05-22 11:13:34 +02:00
|
|
|
using Robust.Server.Player;
|
2019-11-25 00:11:47 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 15:32:05 +01:00
|
|
|
using Robust.Shared.IoC;
|
2019-11-25 00:11:47 +01:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-11-28 01:47:36 +01:00
|
|
|
namespace Content.Server.Instruments;
|
2019-11-25 00:11:47 +01:00
|
|
|
|
2021-11-28 01:47:36 +01:00
|
|
|
[RegisterComponent, ComponentReference(typeof(SharedInstrumentComponent))]
|
|
|
|
|
public sealed class InstrumentComponent : SharedInstrumentComponent
|
|
|
|
|
{
|
2021-12-08 17:17:12 +01:00
|
|
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
|
|
|
|
|
2021-11-28 01:47:36 +01:00
|
|
|
[ViewVariables]
|
|
|
|
|
public float Timer = 0f;
|
2021-03-15 21:55:49 +01:00
|
|
|
|
2021-11-28 01:47:36 +01:00
|
|
|
[ViewVariables]
|
|
|
|
|
public int BatchesDropped = 0;
|
2020-05-21 19:18:10 +02:00
|
|
|
|
2021-11-28 01:47:36 +01:00
|
|
|
[ViewVariables]
|
|
|
|
|
public int LaggedBatches = 0;
|
2020-06-02 14:42:23 -04:00
|
|
|
|
2021-11-28 01:47:36 +01:00
|
|
|
[ViewVariables]
|
|
|
|
|
public int MidiEventCount = 0;
|
2020-06-02 14:42:23 -04:00
|
|
|
|
2021-12-08 17:17:12 +01:00
|
|
|
// TODO Instruments: Make this ECS
|
2021-11-28 01:47:36 +01:00
|
|
|
public IPlayerSession? InstrumentPlayer =>
|
2021-12-08 17:17:12 +01:00
|
|
|
_entMan.GetComponentOrNull<ActivatableUIComponent>(Owner)?.CurrentSingleUser
|
|
|
|
|
?? _entMan.GetComponentOrNull<ActorComponent>(Owner)?.PlayerSession;
|
2020-06-02 14:42:23 -04:00
|
|
|
|
2021-11-28 01:47:36 +01:00
|
|
|
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
2019-11-25 00:11:47 +01:00
|
|
|
}
|
2022-04-04 23:08:36 -07:00
|
|
|
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
public sealed class ActiveInstrumentComponent : Component {}
|