InteractionSystem: Fix exception when clicking around off-grid (GridCoordinates/default grid leftovers?) (#2624)

This commit is contained in:
20kdc
2020-11-24 12:23:49 +00:00
committed by GitHub
parent 607be16c0d
commit d7685512bb

View File

@@ -36,7 +36,6 @@ namespace Content.Server.GameObjects.EntitySystems.Click
[UsedImplicitly]
public sealed class InteractionSystem : SharedInteractionSystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
public override void Initialize()
@@ -805,7 +804,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
private void DoAttack(IEntity player, EntityCoordinates coordinates, bool wideAttack, EntityUid target = default)
{
// Verify player is on the same map as the entity he clicked on
if (_mapManager.GetGrid(coordinates.GetGridId(EntityManager)).ParentMapId != player.Transform.MapID)
if (coordinates.GetMapId(EntityManager) != player.Transform.MapID)
{
Logger.WarningS("system.interaction",
$"Player named {player.Name} clicked on a map he isn't located on");