Files
OldThink/Content.Server/Instruments/InstrumentComponent.cs

32 lines
1000 B
C#
Raw Normal View History

2021-06-09 22:19:39 +02:00
using Content.Server.UserInterface;
using Content.Shared.Instruments;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
2021-12-03 15:32:05 +01:00
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
2021-11-28 01:47:36 +01:00
namespace Content.Server.Instruments;
2021-11-28 01:47:36 +01:00
[RegisterComponent, ComponentReference(typeof(SharedInstrumentComponent))]
public sealed class InstrumentComponent : SharedInstrumentComponent
{
[ViewVariables]
public float Timer = 0f;
2021-11-28 01:47:36 +01:00
[ViewVariables]
public int BatchesDropped = 0;
2021-11-28 01:47:36 +01:00
[ViewVariables]
public int LaggedBatches = 0;
2021-11-28 01:47:36 +01:00
[ViewVariables]
public int MidiEventCount = 0;
2021-11-28 01:47:36 +01:00
public IPlayerSession? InstrumentPlayer =>
2021-12-03 15:53:09 +01:00
IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActivatableUIComponent>(Owner)?.CurrentSingleUser
?? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActorComponent>(Owner)?.PlayerSession;
2021-11-28 01:47:36 +01:00
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
}