Remove ignore-inside-blocker (#6692)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Leon Friedrich
2022-02-17 15:40:03 +13:00
committed by GitHub
parent 00c3a181d3
commit 4a00d01ced
60 changed files with 297 additions and 872 deletions

View File

@@ -1,4 +1,4 @@
using Content.Server.AI.Utility;
using Content.Server.AI.Utility;
using Content.Server.AI.WorldState.States.Inventory;
using Content.Server.Storage.Components;
using Content.Shared.Interaction;
@@ -54,7 +54,7 @@ namespace Content.Server.AI.Operators.Inventory
public override Outcome Execute(float frameTime)
{
if (_target == default || !_owner.InRangeUnobstructed(_target, popup: true))
if (_target == default || !EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(_owner, _target, popup: true))
{
return Outcome.Failed;
}

View File

@@ -1,5 +1,6 @@
using Content.Server.CombatMode;
using Content.Server.Interaction;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -34,7 +35,9 @@ namespace Content.Server.AI.Operators.Inventory
return Outcome.Failed;
}
if (!_owner.InRangeUnobstructed(_useTarget, popup: true))
var interactionSystem = EntitySystem.Get<InteractionSystem>();
if (!interactionSystem.InRangeUnobstructed(_owner, _useTarget, popup: true))
{
return Outcome.Failed;
}
@@ -45,7 +48,6 @@ namespace Content.Server.AI.Operators.Inventory
}
// Click on da thing
var interactionSystem = EntitySystem.Get<InteractionSystem>();
interactionSystem.AiUseInteraction(_owner, targetTransform.Coordinates, _useTarget);
return Outcome.Success;

View File

@@ -1,4 +1,4 @@
using Content.Server.AI.Utility;
using Content.Server.AI.Utility;
using Content.Server.AI.WorldState.States.Inventory;
using Content.Server.Storage.Components;
using Content.Shared.Interaction;
@@ -30,7 +30,7 @@ namespace Content.Server.AI.Operators.Inventory
return Outcome.Success;
}
if (!_owner.InRangeUnobstructed(container, popup: true))
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(_owner, container.Owner, popup: true))
{
return Outcome.Failed;
}

View File

@@ -1,5 +1,6 @@
using Content.Server.Hands.Components;
using Content.Server.Interaction;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Item;
using Robust.Shared.Containers;
@@ -27,7 +28,7 @@ namespace Content.Server.AI.Operators.Inventory
if (entMan.Deleted(_target)
|| !entMan.HasComponent<SharedItemComponent>(_target)
|| _target.IsInContainer()
|| !_owner.InRangeUnobstructed(_target, popup: true))
|| !EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(_owner, _target, popup: true))
{
return Outcome.Failed;
}

View File

@@ -9,6 +9,7 @@ using Content.Server.AI.Pathfinding.Pathfinders;
using Content.Server.CPUJob.JobQueues;
using Content.Shared.Access.Systems;
using Content.Shared.ActionBlocker;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -28,6 +29,7 @@ namespace Content.Server.AI.Steering
[Dependency] private readonly IPauseManager _pauseManager = default!;
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
/// <summary>
/// Whether we try to avoid non-blocking physics objects
@@ -283,7 +285,7 @@ namespace Content.Server.AI.Steering
if (targetDistance <= steeringRequest.ArrivalDistance && steeringRequest.TimeUntilInteractionCheck <= 0.0f)
{
if (!steeringRequest.RequiresInRangeUnobstructed ||
entity.InRangeUnobstructed(steeringRequest.TargetMap, steeringRequest.ArrivalDistance, popup: true))
_interactionSystem.InRangeUnobstructed(entity, steeringRequest.TargetMap, steeringRequest.ArrivalDistance, popup: true))
{
// TODO: Need cruder LOS checks for ranged weaps
controller.VelocityDir = Vector2.Zero;

View File

@@ -13,7 +13,6 @@ using Content.Shared.Actions.Components;
using Content.Shared.Audio;
using Content.Shared.Cooldown;
using Content.Shared.Database;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Popups;
using Content.Shared.Sound;
using JetBrains.Annotations;
@@ -56,7 +55,9 @@ namespace Content.Server.Actions.Actions
if (attemptEvent.Cancelled)
return;
if (!args.Performer.InRangeUnobstructed(args.Target)) return;
var sys = EntitySystem.Get<InteractionSystem>();
if (!sys.InRangeUnobstructed(args.Performer, args.Target)) return;
if (disarmedActs.Length == 0)
{
@@ -66,7 +67,7 @@ namespace Content.Server.Actions.Actions
var player = actor.PlayerSession;
var coordinates = entMan.GetComponent<TransformComponent>(args.Target).Coordinates;
var target = args.Target;
EntitySystem.Get<InteractionSystem>().HandleUseInteraction(player, coordinates, target);
sys.HandleUseInteraction(player, coordinates, target);
return;
}

View File

@@ -252,9 +252,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!EntityManager.TryGetComponent(args.User, out HandsComponent? hands))
return;
if (!args.User.InRangeUnobstructed(canister, SharedInteractionSystem.InteractionRange, popup: true))
return;
if (!hands.Drop(args.Used, container))
return;

View File

@@ -1,11 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Hands.Components;
using Content.Server.Pulling;
using Content.Shared.ActionBlocker;
using Content.Shared.Alert;
using Content.Shared.Buckle.Components;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Interaction;
using Content.Shared.MobState.Components;
using Content.Shared.Popups;
using Content.Shared.Pulling.Components;
@@ -14,14 +13,8 @@ using Content.Shared.Stunnable;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
namespace Content.Server.Buckle.Components
{
@@ -146,7 +139,7 @@ namespace Content.Server.Buckle.Components
var strapUid = strap.Owner;
bool Ignored(EntityUid entity) => entity == Owner || entity == user || entity == strapUid;
if (!Owner.InRangeUnobstructed(strapUid, Range, predicate: Ignored, popup: true))
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(Owner, strapUid, Range, predicate: Ignored, popup: true))
{
return false;
}
@@ -288,7 +281,7 @@ namespace Content.Server.Buckle.Components
return false;
}
if (!user.InRangeUnobstructed(oldBuckledTo.Owner, Range, popup: true))
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(user, oldBuckledTo.Owner, Range, popup: true))
{
return false;
}

View File

@@ -1,4 +1,3 @@
using System;
using Content.Server.DoAfter;
using Content.Server.Popups;
using Content.Shared.ActionBlocker;
@@ -6,17 +5,10 @@ using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Climbing;
using Content.Shared.DragDrop;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Popups;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Climbing.Components
{
@@ -91,7 +83,7 @@ namespace Content.Server.Climbing.Components
return false;
}
if (!user.InRangeUnobstructed(target, Range))
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(user, target, Range))
{
reason = Loc.GetString("comp-climbable-cant-reach");
return false;
@@ -135,8 +127,9 @@ namespace Content.Server.Climbing.Components
bool Ignored(EntityUid entity) => entity == target || entity == user || entity == dragged;
if (!user.InRangeUnobstructed(target, Range, predicate: Ignored) ||
!user.InRangeUnobstructed(dragged, Range, predicate: Ignored))
var sys = EntitySystem.Get<SharedInteractionSystem>();
if (!sys.InRangeUnobstructed(user, target, Range, predicate: Ignored) ||
!sys.InRangeUnobstructed(user, dragged, Range, predicate: Ignored))
{
reason = Loc.GetString("comp-climbable-cant-reach");
return false;

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -11,15 +10,10 @@ using Content.Shared.Construction;
using Content.Shared.Construction.Prototypes;
using Content.Shared.Construction.Steps;
using Content.Shared.Coordinates;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Item;
using Content.Shared.Popups;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Players;
using Robust.Shared.Timing;
@@ -29,6 +23,8 @@ namespace Content.Server.Construction
{
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
// --- WARNING! LEGACY CODE AHEAD! ---
// This entire file contains the legacy code for initial construction.
@@ -399,15 +395,23 @@ namespace Content.Server.Construction
_beingBuilt[args.SenderSession].Remove(ev.Ack);
}
if (!Get<ActionBlockerSystem>().CanInteract(user, null)
|| !EntityManager.TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHandItem == null
|| !user.InRangeUnobstructed(ev.Location, ignoreInsideBlocker:constructionPrototype.CanBuildInImpassable))
if (!_actionBlocker.CanInteract(user, null)
|| !EntityManager.TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHandItem == null)
{
Cleanup();
return;
}
if(pathFind == null)
var mapPos = ev.Location.ToMap(EntityManager);
var predicate = GetPredicate(constructionPrototype.CanBuildInImpassable, mapPos);
if (!_interactionSystem.InRangeUnobstructed(user, mapPos, predicate: predicate))
{
Cleanup();
return;
}
if (pathFind == null)
throw new InvalidDataException($"Can't find path from starting node to target node in construction! Recipe: {ev.PrototypeName}");
var edge = startNode.GetEdge(pathFind[0].Name);

View File

@@ -5,6 +5,7 @@ using Content.Server.DoAfter;
using Content.Server.Hands.Components;
using Content.Shared.Alert;
using Content.Shared.Cuffs.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Popups;
using Robust.Server.GameObjects;
@@ -96,7 +97,7 @@ namespace Content.Server.Cuffs.Components
return false;
}
if (!handcuff.InRangeUnobstructed(Owner))
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(handcuff, Owner))
{
Logger.Warning("Handcuffs being applied to player are obstructed or too far away! This should not happen!");
return true;
@@ -210,7 +211,7 @@ namespace Content.Server.Cuffs.Components
return;
}
if (!isOwner && !user.InRangeUnobstructed(Owner))
if (!isOwner && !EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(user, Owner))
{
user.PopupMessage(Loc.GetString("cuffable-component-cannot-remove-cuffs-too-far-message"));
return;

View File

@@ -1,6 +1,7 @@
using Content.Server.DoAfter;
using Content.Server.Engineering.Components;
using Content.Server.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Item;
using Content.Shared.Verbs;
@@ -10,6 +11,8 @@ namespace Content.Server.Engineering.EntitySystems
[UsedImplicitly]
public sealed class DisassembleOnAltVerbSystem : EntitySystem
{
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
base.Initialize();
@@ -18,7 +21,7 @@ namespace Content.Server.Engineering.EntitySystems
}
private void AddDisassembleVerb(EntityUid uid, DisassembleOnAltVerbComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanInteract)
if (!args.CanInteract || !args.CanAccess)
return;
AlternativeVerb verb = new()
@@ -39,8 +42,6 @@ namespace Content.Server.Engineering.EntitySystems
return;
if (string.IsNullOrEmpty(component.Prototype))
return;
if (!user.InRangeUnobstructed(target))
return;
if (component.DoAfterTime > 0 && TryGet<DoAfterSystem>(out var doAfterSystem))
{

View File

@@ -37,7 +37,7 @@ namespace Content.Server.Engineering.EntitySystems
bool IsTileClear()
{
return tileRef.Tile.IsEmpty == false && args.User.InRangeUnobstructed(args.ClickLocation, popup: true);
return tileRef.Tile.IsEmpty == false;
}
if (!IsTileClear())

View File

@@ -6,6 +6,7 @@ using Content.Server.Explosion.Components;
using Content.Shared.Acts;
using Content.Shared.Camera;
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Maps;
using Content.Shared.Physics;
@@ -27,6 +28,8 @@ namespace Content.Server.Explosion.EntitySystems
{
public sealed class ExplosionSystem : EntitySystem
{
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
/// <summary>
/// Distance used for camera shake when distance from explosion is (0.0, 0.0).
/// Avoids getting NaN values down the line from doing math on (0.0, 0.0).
@@ -174,7 +177,7 @@ namespace Content.Server.Explosion.EntitySystems
var epicenterMapPos = epicenter.ToMap(EntityManager);
foreach (var (entity, distance) in impassableEntities)
{
if (!entity.InRangeUnobstructed(epicenterMapPos, maxRange, ignoreInsideBlocker: true, predicate: IgnoreExplosivePassable))
if (!_interactionSystem.InRangeUnobstructed(epicenterMapPos, entity, maxRange, predicate: IgnoreExplosivePassable))
{
continue;
}
@@ -186,7 +189,7 @@ namespace Content.Server.Explosion.EntitySystems
// there are probably more ExplosivePassable entities around
foreach (var (entity, distance) in nonImpassableEntities)
{
if (!entity.InRangeUnobstructed(epicenterMapPos, maxRange, ignoreInsideBlocker: true, predicate: IgnoreExplosivePassable))
if (!_interactionSystem.InRangeUnobstructed(epicenterMapPos, entity, maxRange, predicate: IgnoreExplosivePassable))
{
continue;
}
@@ -235,7 +238,7 @@ namespace Content.Server.Explosion.EntitySystems
continue;
}
if (!tileLoc.ToMap(EntityManager).InRangeUnobstructed(epicenterMapPos, maxRange, ignoreInsideBlocker: false, predicate: IgnoreExplosivePassable))
if (!_interactionSystem.InRangeUnobstructed(tileLoc.ToMap(EntityManager), epicenterMapPos, maxRange, predicate: IgnoreExplosivePassable))
{
continue;
}

View File

@@ -28,6 +28,7 @@ namespace Content.Server.Flash
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly StunSystem _stunSystem = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
@@ -153,7 +154,7 @@ namespace Content.Server.Flash
foreach (var entity in flashableEntities)
{
// Check for unobstructed entities while ignoring the mobs with flashable components.
if (!transform.InRangeUnobstructed(entity, range, CollisionGroup.Opaque, (e) => flashableEntities.Contains(e)))
if (!_interactionSystem.InRangeUnobstructed(entity, transform.MapPosition, range, CollisionGroup.Opaque, (e) => flashableEntities.Contains(e)))
continue;
Flash(entity, user, source, duration, slowTo, displayPopup);

View File

@@ -85,7 +85,7 @@ namespace Content.Server.Fluids.Components
_currentlyUsing.Remove(eventArgs.Using);
if (result == DoAfterStatus.Cancelled || _entMan.Deleted(Owner) || mopComponent.Deleted ||
CurrentVolume <= 0 || !Owner.InRangeUnobstructed(mopComponent.Owner))
CurrentVolume <= 0 || !EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(Owner, mopComponent.Owner))
return false;
//Checks if the mop is empty

View File

@@ -110,7 +110,8 @@ namespace Content.Server.Interaction
// must be in range of both the target and the object they are drag / dropping
// Client also does this check but ya know we gotta validate it.
if (!interactionArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
if (!InRangeUnobstructed(interactionArgs.User, interactionArgs.Dragged, popup: true)
|| !InRangeUnobstructed(interactionArgs.User, interactionArgs.Target, popup: true))
return;
// trigger dragdrops on the dropped entity
@@ -311,7 +312,11 @@ namespace Content.Server.Interaction
}
// TODO: Replace with body attack range when we get something like arm length or telekinesis or something.
if (!user.InRangeUnobstructed(coordinates, ignoreInsideBlocker: true))
var unobstructed = (target == null)
? InRangeUnobstructed(user, coordinates)
: InRangeUnobstructed(user, target.Value);
if (!unobstructed)
return;
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Hands.Components;
using Content.Server.Interaction;
@@ -125,7 +125,6 @@ namespace Content.Server.MachineLinking.System
!EntityManager.TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) ||
!hands.TryGetActiveHeldEntity(out var heldEntity) ||
!EntityManager.TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) ||
!_interaction.InRangeUnobstructed(attached, component.Owner, ignoreInsideBlocker: true) ||
!signalLinkerComponent.Port.HasValue ||
!signalLinkerComponent.Port.Value.transmitter.Outputs.ContainsPort(signalLinkerComponent.Port
.Value.port) || !component.Inputs.ContainsPort(portSelected.Port))
@@ -167,8 +166,7 @@ namespace Content.Server.MachineLinking.System
if (msg.Session.AttachedEntity == default ||
!EntityManager.TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) ||
!hands.TryGetActiveHeldEntity(out var heldEntity) ||
!EntityManager.TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) ||
!_interaction.InRangeUnobstructed(attached, component.Owner, ignoreInsideBlocker: true))
!EntityManager.TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent))
return;
LinkerSaveInteraction(attached, signalLinkerComponent, component,
portSelected.Port);

View File

@@ -19,6 +19,7 @@ public sealed class HealingSystem : EntitySystem
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly StackSystem _stacks = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
@@ -87,7 +88,7 @@ public sealed class HealingSystem : EntitySystem
return;
if (user != target &&
!user.InRangeUnobstructed(target, ignoreInsideBlocker: true, popup: true))
!_interactionSystem.InRangeUnobstructed(user, target, popup: true))
{
return;
}

View File

@@ -79,7 +79,7 @@ namespace Content.Server.Morgue.Components
public override bool CanOpen(EntityUid user, bool silent = false)
{
if (!Owner.InRangeUnobstructed(
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(Owner,
_entMan.GetComponent<TransformComponent>(Owner).Coordinates.Offset(_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetCardinalDir()),
collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable
))

View File

@@ -41,6 +41,7 @@ namespace Content.Server.Nutrition.EntitySystems
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!;
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
@@ -212,7 +213,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (_foodSystem.IsMouthBlocked(target, user))
return true;
if (!user.InRangeUnobstructed(drink.Owner, popup: true))
if (!_interactionSystem.InRangeUnobstructed(user, drink.Owner, popup: true))
return true;
var forceDrink = user != target;

View File

@@ -14,13 +14,9 @@ using Content.Shared.Chemistry.Reagent;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.MobState.Components;
using Content.Shared.Verbs;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using Content.Shared.Inventory;
@@ -41,6 +37,7 @@ namespace Content.Server.Nutrition.EntitySystems
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
@@ -111,7 +108,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (!TryGetRequiredUtensils(user, food, out var utensils))
return false;
if (!user.InRangeUnobstructed(food.Owner, popup: true))
if (!_interactionSystem.InRangeUnobstructed(user, food.Owner, popup: true))
return true;
var forceFeed = user != target;

View File

@@ -19,6 +19,7 @@ namespace Content.Server.Nutrition.EntitySystems
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly FoodSystem _foodSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
@@ -51,7 +52,7 @@ namespace Content.Server.Nutrition.EntitySystems
return false;
}
if (!user.InRangeUnobstructed(target, popup: true))
if (!_interactionSystem.InRangeUnobstructed(user, target, popup: true))
return false;
return _foodSystem.TryFeed(user, target, food);

View File

@@ -162,7 +162,7 @@ namespace Content.Server.RCD.Systems
var coordinates = mapGrid.ToCoordinates(tile.GridIndices);
if (coordinates == EntityCoordinates.Invalid ||
!_interactionSystem.InRangeUnobstructed(eventArgs.User, coordinates, ignoreInsideBlocker: true, popup: true))
!_interactionSystem.InRangeUnobstructed(eventArgs.User, coordinates, popup: true))
{
return false;
}

View File

@@ -77,7 +77,7 @@ namespace Content.Server.Radio.Components
public bool CanListen(string message, EntityUid source)
{
return RadioOn &&
Owner.InRangeUnobstructed(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(source).Coordinates, range: ListenRange);
EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(Owner, source, range: ListenRange);
}
public void Receive(string message, int channel, EntityUid speaker)

View File

@@ -498,7 +498,7 @@ namespace Content.Server.Storage.Components
break;
}
if (!player.InRangeUnobstructed(Owner, popup: true))
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(player, Owner, popup: true))
{
break;
}

View File

@@ -11,6 +11,8 @@ namespace Content.Server.Tools;
public sealed partial class ToolSystem
{
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
private void InitializeTilePrying()
{
SubscribeLocalEvent<TilePryingComponent, AfterInteractEvent>(OnTilePryingAfterInteract);
@@ -50,7 +52,7 @@ public sealed partial class ToolSystem
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
if (!user.InRangeUnobstructed(coordinates, popup: false))
if (!_interactionSystem.InRangeUnobstructed(user, coordinates, popup: false))
return false;
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];

View File

@@ -332,7 +332,7 @@ namespace Content.Server.WireHacking
return false;
}
if (!user.InRangeUnobstructed(Owner))
if (!EntitySystem.Get<SharedInteractionSystem>().InRangeUnobstructed(user, Owner))
{
Owner.PopupMessage(user, Loc.GetString("wires-component-ui-on-receive-message-cannot-reach"));
return false;

View File

@@ -1,9 +1,5 @@
using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components;
using Content.Shared.ActionBlocker;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Systems;
@@ -21,8 +17,6 @@ public sealed class ArtifactInteractionTriggerSystem : EntitySystem
{
if (args.Handled)
return;
if (!args.InRangeUnobstructed())
return;
args.Handled = _artifactSystem.TryActivateArtifact(uid, args.User);
}