Fix laser collision logic wrt transparent entities (#1018)
This commit is contained in:
@@ -93,10 +93,11 @@ 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 CollisionRay(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
var ray = new CollisionRay(userPosition, angle.ToVec(), (int)(CollisionGroup.Opaque));
|
||||||
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(user.Transform.MapID, ray, MaxLength, user).ToList();
|
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(user.Transform.MapID, ray, MaxLength, user, returnOnFirstHit: false).ToList();
|
||||||
|
|
||||||
if (rayCastResults.Count == 1)
|
//The first result is guaranteed to be the closest one
|
||||||
|
if (rayCastResults.Count >= 1)
|
||||||
{
|
{
|
||||||
Hit(rayCastResults[0], energyModifier, user);
|
Hit(rayCastResults[0], energyModifier, user);
|
||||||
AfterEffects(user, rayCastResults[0], angle, energyModifier);
|
AfterEffects(user, rayCastResults[0], angle, energyModifier);
|
||||||
|
|||||||
@@ -109,6 +109,7 @@
|
|||||||
- VaultImpassable
|
- VaultImpassable
|
||||||
- SmallImpassable
|
- SmallImpassable
|
||||||
layer:
|
layer:
|
||||||
|
- Opaque
|
||||||
- MobImpassable
|
- MobImpassable
|
||||||
- type: Input
|
- type: Input
|
||||||
context: "human"
|
context: "human"
|
||||||
|
|||||||
Reference in New Issue
Block a user