From 6cc88115b50f641d0b4e01b1b4abd5d59a84d52d Mon Sep 17 00:00:00 2001 From: Acruid Date: Thu, 25 Oct 2018 17:29:33 -0700 Subject: [PATCH] Rename ICollisionManager to IPhysicsManager (#113) * Renamed ICollisionManager to IPhysicsManager. * Added sanitization and logging for clients sending invalid coordinates to the interaction system. * Update Engine. --- Content.Server/AI/AimShootLifeProcessor.cs | 4 ++-- .../Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs | 2 +- .../GameObjects/EntitySystems/Click/InteractionSystem.cs | 7 +++++++ engine | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Content.Server/AI/AimShootLifeProcessor.cs b/Content.Server/AI/AimShootLifeProcessor.cs index 6b79ab6365..1c63fc0aa4 100644 --- a/Content.Server/AI/AimShootLifeProcessor.cs +++ b/Content.Server/AI/AimShootLifeProcessor.cs @@ -19,7 +19,7 @@ namespace Content.Server.AI [AiLogicProcessor("AimShootLife")] class AimShootLifeProcessor : AiLogicProcessor { - private readonly ICollisionManager _physMan; + private readonly IPhysicsManager _physMan; private readonly IServerEntityManager _entMan; private readonly IGameTiming _timeMan; @@ -36,7 +36,7 @@ namespace Content.Server.AI /// public AimShootLifeProcessor() { - _physMan = IoCManager.Resolve(); + _physMan = IoCManager.Resolve(); _entMan = IoCManager.Resolve(); _timeMan = IoCManager.Resolve(); } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs index ddbb8f4a2d..1d9025356d 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs @@ -26,7 +26,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan var angle = new Angle(clicklocation.Position - userPosition); var ray = new Ray(userPosition, angle.ToVec()); - var rayCastResults = IoCManager.Resolve().IntersectRay(ray, MaxLength, + var rayCastResults = IoCManager.Resolve().IntersectRay(ray, MaxLength, Owner.Transform.GetMapTransform().Owner); Hit(rayCastResults); diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index afd9d2006d..cc182a0df5 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -137,6 +137,13 @@ namespace Content.Server.GameObjects.EntitySystems private void HandleUseItemInHand(ICommonSession session, GridLocalCoordinates coords, EntityUid uid) { + // client sanitization + if(!coords.IsValidLocation()) + { + Logger.InfoS("interaction", $"Invalid Coordinates: client={session}, coords={coords}"); + return; + } + UserInteraction(((IPlayerSession)session).AttachedEntity, coords, uid); } diff --git a/engine b/engine index 99ab6fce9c..d8ca95db0c 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit 99ab6fce9c63e77401d2cb97cb8cff62dff183e3 +Subproject commit d8ca95db0c1a8e1db48465352e29c7650b3afc81