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

View File

@@ -3,33 +3,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Audio; using Content.Shared.Audio;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Maps;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems; using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems; using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Interactable namespace Content.Server.GameObjects.Components.Interactable