2020-11-27 17:12:45 +01:00
|
|
|
using Content.Shared;
|
2021-06-13 14:52:40 +02:00
|
|
|
using Content.Shared.CCVar;
|
2020-08-13 22:17:12 +10:00
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.Configuration;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-11-27 17:12:45 +01:00
|
|
|
using Robust.Shared.IoC;
|
2020-05-18 13:29:31 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Instruments
|
2020-05-18 13:29:31 +02:00
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
[UsedImplicitly]
|
|
|
|
|
internal sealed class InstrumentSystem : EntitySystem
|
2020-05-18 13:29:31 +02:00
|
|
|
{
|
2020-11-27 17:12:45 +01:00
|
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
_cfg.OnValueChanged(CCVars.MaxMidiEventsPerSecond, OnMaxMidiEventsPerSecondChanged, true);
|
|
|
|
|
_cfg.OnValueChanged(CCVars.MaxMidiEventsPerBatch, OnMaxMidiEventsPerBatchChanged, true);
|
|
|
|
|
_cfg.OnValueChanged(CCVars.MaxMidiBatchesDropped, OnMaxMidiBatchesDroppedChanged, true);
|
|
|
|
|
_cfg.OnValueChanged(CCVars.MaxMidiLaggedBatches, OnMaxMidiLaggedBatchesChanged, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int MaxMidiEventsPerSecond { get; private set; }
|
|
|
|
|
public int MaxMidiEventsPerBatch { get; private set; }
|
|
|
|
|
public int MaxMidiBatchesDropped { get; private set; }
|
|
|
|
|
public int MaxMidiLaggedBatches { get; private set; }
|
|
|
|
|
|
|
|
|
|
private void OnMaxMidiLaggedBatchesChanged(int obj)
|
|
|
|
|
{
|
|
|
|
|
MaxMidiLaggedBatches = obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnMaxMidiBatchesDroppedChanged(int obj)
|
|
|
|
|
{
|
|
|
|
|
MaxMidiBatchesDropped = obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnMaxMidiEventsPerBatchChanged(int obj)
|
|
|
|
|
{
|
|
|
|
|
MaxMidiEventsPerBatch = obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnMaxMidiEventsPerSecondChanged(int obj)
|
|
|
|
|
{
|
|
|
|
|
MaxMidiEventsPerSecond = obj;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-18 13:29:31 +02:00
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
base.Update(frameTime);
|
|
|
|
|
|
2021-09-28 13:35:29 +02:00
|
|
|
foreach (var component in EntityManager.EntityQuery<InstrumentComponent>(true))
|
2020-05-18 13:29:31 +02:00
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
component.Update(frameTime);
|
2020-05-18 13:29:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|