diff --git a/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs b/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs
index 3896718c1a..85d6119014 100644
--- a/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs
+++ b/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs
@@ -52,6 +52,8 @@ namespace Content.Client.GameObjects.Components.Instruments
private bool _allowProgramChange;
+ private bool _respectMidiLimits;
+
///
/// A queue of MidiEvents to be sent to the server.
///
@@ -239,6 +241,7 @@ namespace Content.Client.GameObjects.Components.Instruments
serializer.DataField(ref _instrumentBank, "bank", (byte) 0);
serializer.DataField(ref _allowPercussion, "allowPercussion", false);
serializer.DataField(ref _allowProgramChange, "allowProgramChange", false);
+ serializer.DataField(ref _respectMidiLimits, "respectMidiLimits", true);
}
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
@@ -429,7 +432,9 @@ namespace Content.Client.GameObjects.Components.Instruments
if (_midiEventBuffer.Count == 0) return;
- var max = Math.Min(_instrumentSystem.MaxMidiEventsPerBatch, _instrumentSystem.MaxMidiEventsPerSecond - _sentWithinASec);
+ var max = _respectMidiLimits ?
+ Math.Min(_instrumentSystem.MaxMidiEventsPerBatch, _instrumentSystem.MaxMidiEventsPerSecond - _sentWithinASec)
+ : _midiEventBuffer.Count;
if (max <= 0)
{
diff --git a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs
index 40269775d1..289ebcce79 100644
--- a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs
+++ b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs
@@ -78,8 +78,8 @@ namespace Content.Server.GameObjects.Components.Instruments
private byte _instrumentBank;
private bool _allowPercussion;
private bool _allowProgramChange;
+ private bool _respectMidiLimits;
- [ViewVariables(VVAccess.ReadWrite)]
public override byte InstrumentProgram { get => _instrumentProgram;
set
{
@@ -88,7 +88,6 @@ namespace Content.Server.GameObjects.Components.Instruments
}
}
- [ViewVariables(VVAccess.ReadWrite)]
public override byte InstrumentBank { get => _instrumentBank;
set
{
@@ -97,7 +96,6 @@ namespace Content.Server.GameObjects.Components.Instruments
}
}
- [ViewVariables(VVAccess.ReadWrite)]
public override bool AllowPercussion { get => _allowPercussion;
set
{
@@ -106,7 +104,6 @@ namespace Content.Server.GameObjects.Components.Instruments
}
}
- [ViewVariables(VVAccess.ReadWrite)]
public override bool AllowProgramChange { get => _allowProgramChange;
set
{
@@ -115,6 +112,14 @@ namespace Content.Server.GameObjects.Components.Instruments
}
}
+ public override bool RespectMidiLimits { get => _respectMidiLimits;
+ set
+ {
+ _respectMidiLimits = value;
+ Dirty();
+ }
+ }
+
///
/// Whether the instrument is an item which can be held or not.
///
@@ -181,11 +186,12 @@ namespace Content.Server.GameObjects.Components.Instruments
serializer.DataField(ref _instrumentBank, "bank", (byte) 0);
serializer.DataField(ref _allowPercussion, "allowPercussion", false);
serializer.DataField(ref _allowProgramChange, "allowProgramChange", false);
+ serializer.DataField(ref _respectMidiLimits, "respectMidiLimits", true);
}
public override ComponentState GetComponentState()
{
- return new InstrumentState(Playing, InstrumentProgram, InstrumentBank, AllowPercussion, AllowProgramChange, _lastSequencerTick);
+ return new InstrumentState(Playing, InstrumentProgram, InstrumentBank, AllowPercussion, AllowProgramChange, RespectMidiLimits, _lastSequencerTick);
}
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
@@ -217,14 +223,17 @@ namespace Content.Server.GameObjects.Components.Instruments
_laggedBatches++;
- if (_laggedBatches == (int) (maxMidiLaggedBatches * (1 / 3d) + 1))
+ if (_respectMidiLimits)
{
- Owner.PopupMessage(InstrumentPlayer.AttachedEntity,
- Loc.GetString("Your fingers are beginning to a cramp a little!"));
- } else if (_laggedBatches == (int) (maxMidiLaggedBatches * (2 / 3d) + 1))
- {
- Owner.PopupMessage(InstrumentPlayer.AttachedEntity,
- Loc.GetString("Your fingers are seriously cramping up!"));
+ if (_laggedBatches == (int) (maxMidiLaggedBatches * (1 / 3d) + 1))
+ {
+ Owner.PopupMessage(InstrumentPlayer.AttachedEntity,
+ Loc.GetString("Your fingers are beginning to a cramp a little!"));
+ } else if (_laggedBatches == (int) (maxMidiLaggedBatches * (2 / 3d) + 1))
+ {
+ Owner.PopupMessage(InstrumentPlayer.AttachedEntity,
+ Loc.GetString("Your fingers are seriously cramping up!"));
+ }
}
if (_laggedBatches > maxMidiLaggedBatches)
@@ -250,7 +259,7 @@ namespace Content.Server.GameObjects.Components.Instruments
send = false;
}
- if (send)
+ if (send || !_respectMidiLimits)
{
SendNetworkMessage(midiEventMsg);
}
@@ -367,7 +376,7 @@ namespace Content.Server.GameObjects.Components.Instruments
if ((_batchesDropped >= maxMidiBatchDropped
|| _laggedBatches >= maxMidiLaggedBatches)
- && InstrumentPlayer != null)
+ && InstrumentPlayer != null && _respectMidiLimits)
{
var mob = InstrumentPlayer.AttachedEntity;
diff --git a/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs b/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs
index 17b7c5a6df..65f96d9103 100644
--- a/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs
+++ b/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs
@@ -11,11 +11,21 @@ namespace Content.Shared.GameObjects.Components.Instruments
public override string Name => "Instrument";
public override uint? NetID => ContentNetIDs.INSTRUMENTS;
+ [ViewVariables(VVAccess.ReadWrite)]
public virtual byte InstrumentProgram { get; set; }
+
+ [ViewVariables(VVAccess.ReadWrite)]
public virtual byte InstrumentBank { get; set; }
+
+ [ViewVariables(VVAccess.ReadWrite)]
public virtual bool AllowPercussion { get; set; }
+
+ [ViewVariables(VVAccess.ReadWrite)]
public virtual bool AllowProgramChange { get ; set; }
+ [ViewVariables(VVAccess.ReadWrite)]
+ public virtual bool RespectMidiLimits { get; set; }
+
public virtual void Update(float delta)
{
}
@@ -61,14 +71,16 @@ namespace Content.Shared.GameObjects.Components.Instruments
public byte InstrumentBank { get; }
public bool AllowPercussion { get; }
public bool AllowProgramChange { get; }
+ public bool RespectMidiLimits { get; }
- public InstrumentState(bool playing, byte instrumentProgram, byte instrumentBank, bool allowPercussion, bool allowProgramChange, uint sequencerTick = 0) : base(ContentNetIDs.INSTRUMENTS)
+ public InstrumentState(bool playing, byte instrumentProgram, byte instrumentBank, bool allowPercussion, bool allowProgramChange, bool respectMidiLimits, uint sequencerTick = 0) : base(ContentNetIDs.INSTRUMENTS)
{
Playing = playing;
InstrumentProgram = instrumentProgram;
InstrumentBank = instrumentBank;
AllowPercussion = allowPercussion;
AllowProgramChange = allowProgramChange;
+ RespectMidiLimits = respectMidiLimits;
}
}
diff --git a/Resources/Prototypes/Entities/Objects/Fun/instruments.yml b/Resources/Prototypes/Entities/Objects/Fun/instruments.yml
index 6656842ab9..1ed3f2dce3 100644
--- a/Resources/Prototypes/Entities/Objects/Fun/instruments.yml
+++ b/Resources/Prototypes/Entities/Objects/Fun/instruments.yml
@@ -223,3 +223,15 @@
- type: Item
size: 24
sprite: Objects/Fun/Instruments/h_synthesizer.rsi
+
+- type: entity
+ name: super synthesizer
+ suffix: no MIDI limits
+ description: Blasting the ghetto with Touhou MIDIs since 2020.
+ id: SuperSynthesizerUnlimitedInstrument
+ parent: SuperSynthesizerInstrument
+ components:
+ - type: Instrument
+ allowPercussion: true
+ allowProgramChange: true
+ respectMidiLimits: false