Add interaction checks to all interactions (#923)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -40,18 +41,11 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
}
|
||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||
{
|
||||
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||
|
||||
var attacked = eventArgs.Attacked;
|
||||
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.IsSubFloor && attacked == null && Stack.Use(1))
|
||||
{
|
||||
@@ -63,7 +57,7 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user