Instruments no longer stop playback when someone disconnects. Fix #1209

This commit is contained in:
Víctor Aguilera Puerto
2020-06-25 15:01:46 +02:00
parent e294ad0921
commit b8eb9289a6
2 changed files with 8 additions and 21 deletions

View File

@@ -114,8 +114,9 @@ namespace Content.Server.GameObjects.Components.Instruments
private void OnPlayerStatusChanged(object sender, SessionStatusEventArgs e)
{
if (e.NewStatus == SessionStatus.Disconnected)
InstrumentPlayer = null;
if (e.Session != _instrumentPlayer || e.NewStatus != SessionStatus.Disconnected) return;
InstrumentPlayer = null;
Clean();
}
public override void Initialize()
@@ -204,9 +205,13 @@ namespace Content.Server.GameObjects.Components.Instruments
_lastSequencerTick = Math.Max(maxTick, minTick + 1);
break;
case InstrumentStartMidiMessage startMidi:
if (session != _instrumentPlayer)
break;
Playing = true;
break;
case InstrumentStopMidiMessage stopMidi:
if (session != _instrumentPlayer)
break;
Playing = false;
Clean();
break;
@@ -296,6 +301,7 @@ namespace Content.Server.GameObjects.Components.Instruments
if (_instrumentPlayer != null && !ActionBlockerSystem.CanInteract(_instrumentPlayer.AttachedEntity))
{
InstrumentPlayer = null;
Clean();
}
if ((_batchesDropped >= MaxMidiBatchDropped