From 59500e5278eab645e90c45132b375ec66ab428eb Mon Sep 17 00:00:00 2001 From: Acruid Date: Sat, 25 Jan 2020 12:15:04 -0800 Subject: [PATCH] Raycast API changes. --- Content.Server/AI/AimShootLifeProcessor.cs | 2 +- Content.Server/AI/WanderProcessor.cs | 2 +- .../Components/Weapon/Melee/MeleeWeaponComponent.cs | 3 ++- .../Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Content.Server/AI/AimShootLifeProcessor.cs b/Content.Server/AI/AimShootLifeProcessor.cs index 2464191733..5e25573662 100644 --- a/Content.Server/AI/AimShootLifeProcessor.cs +++ b/Content.Server/AI/AimShootLifeProcessor.cs @@ -114,7 +114,7 @@ namespace Content.Server.AI var ray = new Ray(myTransform.WorldPosition, dir.Normalized, (int)(CollisionGroup.MobImpassable | CollisionGroup.Impassable)); // cast the ray - var result = _physMan.IntersectRay(ray, maxRayLen); + var result = _physMan.IntersectRay(myTransform.MapID, ray, maxRayLen, SelfEntity); // add to visible list if (result.HitEntity == entity) diff --git a/Content.Server/AI/WanderProcessor.cs b/Content.Server/AI/WanderProcessor.cs index 39bdf34478..e0a3c5657a 100644 --- a/Content.Server/AI/WanderProcessor.cs +++ b/Content.Server/AI/WanderProcessor.cs @@ -127,7 +127,7 @@ namespace Content.Server.AI { var dir = new Vector2(Random01(ref rngState) * 2 - 1, Random01(ref rngState) *2 -1).Normalized; var ray = new Ray(entWorldPos, dir, (int) CollisionGroup.Impassable); - var rayResult = _physMan.IntersectRay(ray, MaxWalkDistance, SelfEntity); + var rayResult = _physMan.IntersectRay(SelfEntity.Transform.MapID, ray, MaxWalkDistance, SelfEntity); if (rayResult.DidHitObject && rayResult.Distance > 1) // hit an impassable object { diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index 2d2aa67edc..fbb188306d 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -129,10 +129,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee var resSet = new HashSet(); + var mapId = Owner.Transform.MapID; for (var i = 0; i < increments; i++) { var castAngle = new Angle(baseAngle + increment * i); - var res = _physicsManager.IntersectRay(new Ray(position, castAngle.ToVec(), 19), _range, ignore); + var res = _physicsManager.IntersectRay(mapId, new Ray(position, castAngle.ToVec(), 19), _range, ignore); if (res.HitEntity != null) { resSet.Add(res.HitEntity); diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs index dfdd46f4b4..ad0da179e3 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs @@ -90,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan var angle = new Angle(clickLocation.Position - userPosition); var ray = new Ray(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable)); - var rayCastResults = IoCManager.Resolve().IntersectRay(ray, MaxLength, user); + var rayCastResults = IoCManager.Resolve().IntersectRay(user.Transform.MapID, ray, MaxLength, user); Hit(rayCastResults, energyModifier); AfterEffects(user, rayCastResults, angle, energyModifier);