Replaces constructors of Ray with CollisionRay (#594)
Companion of https://github.com/space-wizards/RobustToolbox/pull/951
This commit is contained in:
@@ -111,7 +111,7 @@ namespace Content.Server.AI
|
|||||||
|
|
||||||
// build the ray
|
// build the ray
|
||||||
var dir = entity.GetComponent<ITransformComponent>().WorldPosition - myTransform.WorldPosition;
|
var dir = entity.GetComponent<ITransformComponent>().WorldPosition - myTransform.WorldPosition;
|
||||||
var ray = new Ray(myTransform.WorldPosition, dir.Normalized, (int)(CollisionGroup.MobImpassable | CollisionGroup.Impassable));
|
var ray = new CollisionRay(myTransform.WorldPosition, dir.Normalized, (int)(CollisionGroup.MobImpassable | CollisionGroup.Impassable));
|
||||||
|
|
||||||
// cast the ray
|
// cast the ray
|
||||||
var result = _physMan.IntersectRay(myTransform.MapID, ray, maxRayLen, SelfEntity);
|
var result = _physMan.IntersectRay(myTransform.MapID, ray, maxRayLen, SelfEntity);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace Content.Server.AI
|
|||||||
for (var i = 0; i < 3; i++) // you get 3 chances to find a place to walk
|
for (var i = 0; i < 3; i++) // you get 3 chances to find a place to walk
|
||||||
{
|
{
|
||||||
var dir = new Vector2(Random01(ref rngState) * 2 - 1, Random01(ref rngState) *2 -1).Normalized;
|
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 ray = new CollisionRay(entWorldPos, dir, (int) CollisionGroup.Impassable);
|
||||||
var rayResult = _physMan.IntersectRay(SelfEntity.Transform.MapID, ray, MaxWalkDistance, SelfEntity);
|
var rayResult = _physMan.IntersectRay(SelfEntity.Transform.MapID, ray, MaxWalkDistance, SelfEntity);
|
||||||
|
|
||||||
if (rayResult.DidHitObject && rayResult.Distance > 1) // hit an impassable object
|
if (rayResult.DidHitObject && rayResult.Distance > 1) // hit an impassable object
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
for (var i = 0; i < increments; i++)
|
for (var i = 0; i < increments; i++)
|
||||||
{
|
{
|
||||||
var castAngle = new Angle(baseAngle + increment * i);
|
var castAngle = new Angle(baseAngle + increment * i);
|
||||||
var res = _physicsManager.IntersectRay(mapId, new Ray(position, castAngle.ToVec(), 19), _range, ignore);
|
var res = _physicsManager.IntersectRay(mapId, new CollisionRay(position, castAngle.ToVec(), 19), _range, ignore);
|
||||||
if (res.HitEntity != null)
|
if (res.HitEntity != null)
|
||||||
{
|
{
|
||||||
resSet.Add(res.HitEntity);
|
resSet.Add(res.HitEntity);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
|||||||
var userPosition = user.Transform.WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously
|
var userPosition = user.Transform.WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously
|
||||||
var angle = new Angle(clickLocation.Position - userPosition);
|
var angle = new Angle(clickLocation.Position - userPosition);
|
||||||
|
|
||||||
var ray = new Ray(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
var ray = new CollisionRay(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
||||||
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(user.Transform.MapID, ray, MaxLength, user);
|
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(user.Transform.MapID, ray, MaxLength, user);
|
||||||
|
|
||||||
Hit(rayCastResults, energyModifier);
|
Hit(rayCastResults, energyModifier);
|
||||||
|
|||||||
Reference in New Issue
Block a user