From 5a6cc0933be5b53e9a9509a7312d12f3fccdf0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4mper?= Date: Wed, 20 Jul 2022 18:08:33 +0200 Subject: [PATCH] Allow pAIs to play MIDI again (#9921) --- Content.Client/Instruments/UI/InstrumentMenu.xaml.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs index 7ab5e5f5fd..669d05622e 100644 --- a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs +++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs @@ -142,14 +142,18 @@ namespace Content.Client.Instruments.UI if (instrumentEnt == null || instrument == null) return false; - // If we're a handheld instrument, we might be in a container. Get it just in case. - instrumentEnt.Value.TryGetContainerMan(out var conMan); - var localPlayer = IoCManager.Resolve().LocalPlayer; // If we don't have a player or controlled entity, we return. if (localPlayer?.ControlledEntity == null) return false; + // By default, allow an instrument to play itself and skip all other checks + if (localPlayer.ControlledEntity == instrumentEnt) + return true; + + // If we're a handheld instrument, we might be in a container. Get it just in case. + instrumentEnt.Value.TryGetContainerMan(out var conMan); + // If the instrument is handheld and we're not holding it, we return. if ((instrument.Handheld && (conMan == null || conMan.Owner != localPlayer.ControlledEntity))) return false;