Add interaction checks to all interactions (#923)

This commit is contained in:
chairbender
2020-05-23 02:27:31 -07:00
committed by GitHub
parent af0ec2aeb9
commit 6a4d78cfac
63 changed files with 311 additions and 101 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.Maps;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
@@ -25,17 +26,11 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
public void AfterAttack(AfterAttackEventArgs eventArgs)
{
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
float distance = coordinates.Distance(_mapManager, Owner.Transform.GridPosition);
if (distance > InteractionSystem.InteractionRange)
{
return;
}
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
if (tileDef.CanCrowbar)
{