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

@@ -2,10 +2,10 @@
using System;
using Content.Server.GameObjects.Components.Body.Circulatory;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Utility;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -111,7 +111,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
/// <param name="eventArgs"></param>
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) return;
//Make sure we have the attacking entity
if (eventArgs.Target == null || !Owner.TryGetComponent(out SolutionComponent? solution) || !solution.Injector)