Refactor InRangeUnobstructed and add extension methods (#1925)

* Sort out InRangeUnobstructed and add extension methods

* Rename client RangeChecks to RangeExtensions

* Add container extension methods and test

* Add missing component methods

Component to container
Grid coordinates to container
Map coordinates to container
Local player to container

* Actually use the field

* Merge fixes

* Add popup argument to local player extension methods

* Reduce code repetition for client range extensions
This commit is contained in:
DrSmugleaf
2020-08-30 11:37:06 +02:00
committed by GitHub
parent 9ec3ddf368
commit 9d6c394f6b
39 changed files with 1287 additions and 359 deletions

View File

@@ -1,6 +1,7 @@
using Content.Client.GameObjects.Components.Instruments;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.EntitySystems;
using Content.Client.Utility;
using Content.Shared.Utility;
using Robust.Client.Audio.Midi;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.UserInterface;
@@ -9,7 +10,6 @@ using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
@@ -197,9 +197,7 @@ namespace Content.Client.Instruments
|| conMan.Owner != localPlayer.ControlledEntity))) return;
// We check that we're in range unobstructed just in case.
if(!EntitySystem.Get<SharedInteractionSystem>()
.InRangeUnobstructed(localPlayer.ControlledEntity.Transform.MapPosition,
instrumentEnt.Transform.MapPosition, ignoredEnt:instrumentEnt)) return;
if (!localPlayer.InRangeUnobstructed(instrumentEnt)) return;
if (!_midiManager.IsMidiFile(filename))
{