Add more instrument interaction checks (#9223)
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Client.Interactable;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Client.Audio.Midi;
|
||||
using Robust.Client.AutoGenerated;
|
||||
@@ -132,6 +133,8 @@ namespace Content.Client.Instruments.UI
|
||||
|
||||
private bool PlayCheck()
|
||||
{
|
||||
// TODO all of these checks should also be done server-side.
|
||||
|
||||
var instrumentEnt = _owner.Instrument?.Owner;
|
||||
var instrument = _owner.Instrument;
|
||||
|
||||
@@ -151,8 +154,12 @@ namespace Content.Client.Instruments.UI
|
||||
if ((instrument.Handheld && (conMan == null
|
||||
|| conMan.Owner != localPlayer.ControlledEntity))) return false;
|
||||
|
||||
var entSysMan = IoCManager.Resolve<IEntitySystemManager>();
|
||||
if (!entSysMan.GetEntitySystem<ActionBlockerSystem>().CanInteract(localPlayer.ControlledEntity.Value, instrumentEnt))
|
||||
return false;
|
||||
|
||||
// We check that we're in range unobstructed just in case.
|
||||
return EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(localPlayer.ControlledEntity.Value, instrumentEnt.Value);
|
||||
return entSysMan.GetEntitySystem<SharedInteractionSystem>().InRangeUnobstructed(localPlayer.ControlledEntity.Value, instrumentEnt.Value);
|
||||
}
|
||||
|
||||
private void MidiStopButtonOnPressed(ButtonEventArgs? obj)
|
||||
|
||||
Reference in New Issue
Block a user