Allow pAIs to play MIDI again (#9921)
This commit is contained in:
@@ -142,14 +142,18 @@ namespace Content.Client.Instruments.UI
|
|||||||
if (instrumentEnt == null || instrument == null)
|
if (instrumentEnt == null || instrument == null)
|
||||||
return false;
|
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<IPlayerManager>().LocalPlayer;
|
var localPlayer = IoCManager.Resolve<IPlayerManager>().LocalPlayer;
|
||||||
|
|
||||||
// If we don't have a player or controlled entity, we return.
|
// If we don't have a player or controlled entity, we return.
|
||||||
if (localPlayer?.ControlledEntity == null) return false;
|
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 the instrument is handheld and we're not holding it, we return.
|
||||||
if ((instrument.Handheld && (conMan == null
|
if ((instrument.Handheld && (conMan == null
|
||||||
|| conMan.Owner != localPlayer.ControlledEntity))) return false;
|
|| conMan.Owner != localPlayer.ControlledEntity))) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user