Instruments respect MIDI limits by default again.

Cleans up the limit stun.
This commit is contained in:
Vera Aguilera Puerto
2022-01-27 13:07:35 +01:00
parent 5234572c40
commit fa0c43475c
3 changed files with 11 additions and 10 deletions

View File

@@ -155,20 +155,20 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
instrument.DirtyRenderer = false; instrument.DirtyRenderer = false;
} }
if ((instrument.BatchesDropped >= MaxMidiBatchesDropped if (instrument.RespectMidiLimits && instrument.InstrumentPlayer != null &&
|| instrument.LaggedBatches >= MaxMidiLaggedBatches) (instrument.BatchesDropped >= MaxMidiBatchesDropped
&& instrument.InstrumentPlayer != null && instrument.RespectMidiLimits) || instrument.LaggedBatches >= MaxMidiLaggedBatches))
{ {
// Just in case if (instrument.InstrumentPlayer?.AttachedEntity is {Valid: true} mob)
Clean((instrument).Owner);
instrument.UserInterface?.CloseAll();
if (instrument.InstrumentPlayer.AttachedEntity is {Valid: true} mob)
{ {
_stunSystem.TryParalyze(mob, TimeSpan.FromSeconds(1), true); _stunSystem.TryParalyze(mob, TimeSpan.FromSeconds(1), true);
instrument.Owner.PopupMessage(mob, "instrument-component-finger-cramps-max-message"); instrument.Owner.PopupMessage(mob, Loc.GetString("instrument-component-finger-cramps-max-message"));
} }
// Just in case
Clean((instrument).Owner);
instrument.UserInterface?.CloseAll();
} }
instrument.Timer += frameTime; instrument.Timer += frameTime;

View File

@@ -33,7 +33,7 @@ public class SharedInstrumentComponent : Component
public bool AllowProgramChange { get ; set; } public bool AllowProgramChange { get ; set; }
[DataField("respectMidiLimits"), ViewVariables(VVAccess.ReadWrite)] [DataField("respectMidiLimits"), ViewVariables(VVAccess.ReadWrite)]
public bool RespectMidiLimits { get; set; } public bool RespectMidiLimits { get; set; } = true;
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public bool DirtyRenderer { get; set; } public bool DirtyRenderer { get; set; }

View File

@@ -236,6 +236,7 @@
- type: Instrument - type: Instrument
allowPercussion: true allowPercussion: true
allowProgramChange: true allowProgramChange: true
respectMidiLimits: false
- type: Sprite - type: Sprite
sprite: Objects/Fun/Instruments/h_synthesizer.rsi sprite: Objects/Fun/Instruments/h_synthesizer.rsi
state: icon state: icon