CVars for MIDI instrument limits (#2632)

* CVars for MIDI instruments limits!

* Localize this

* Cache CVars in instrument systems

* better naming

Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
Víctor Aguilera Puerto
2020-11-27 17:12:45 +01:00
committed by GitHub
parent 6bb1e9fa5d
commit cec722e19e
6 changed files with 114 additions and 22 deletions

View File

@@ -182,6 +182,22 @@ namespace Content.Shared
public static readonly CVarDef<bool> ExcitedGroupsSpaceIsAllConsuming =
CVarDef.Create("atmos.excited_groups_space_is_all_consuming", false, CVar.SERVERONLY);
/*
* MIDI instruments
*/
public static readonly CVarDef<int> MaxMidiEventsPerSecond =
CVarDef.Create("midi.max_events_per_second", 1000, CVar.REPLICATED | CVar.SERVER);
public static readonly CVarDef<int> MaxMidiEventsPerBatch =
CVarDef.Create("midi.max_events_per_batch", 60, CVar.REPLICATED | CVar.SERVER);
public static readonly CVarDef<int> MaxMidiBatchesDropped =
CVarDef.Create("midi.max_batches_dropped", 1, CVar.SERVERONLY);
public static readonly CVarDef<int> MaxMidiLaggedBatches =
CVarDef.Create("midi.max_lagged_batches", 8, CVar.SERVERONLY);
/*
* Branding stuff
*/

View File

@@ -8,13 +8,6 @@ namespace Content.Shared.GameObjects.Components.Instruments
{
public class SharedInstrumentComponent : Component
{
// These 2 values are quite high for now, and this could be easily abused. Change this if people are abusing it.
public const int MaxMidiEventsPerSecond = 1000;
public const int MaxMidiEventsPerBatch = 60;
public const int MaxMidiBatchDropped = 1;
public const int MaxMidiLaggedBatches = 8;
public override string Name => "Instrument";
public override uint? NetID => ContentNetIDs.INSTRUMENTS;