Skip to content

Commit

Permalink
GunSystem: fix degenerate direction
Browse files Browse the repository at this point in the history
  • Loading branch information
whatston3 committed Feb 6, 2025
1 parent b203207 commit 50044a9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid?
var fromEffect = fromCoordinates;
var dir = mapDirection.Normalized();

// Frontier: if direction isn't near one (standing on top of target), default to a given direction
if (dir.LengthSquared() < 0.95 || dir.LengthSquared() > 1.05)
dir = new Vector2(1, 0);
// End Frontier

//in the situation when user == null, means that the cannon fires on its own (via signals). And we need the gun to not fire by itself in this case
var lastUser = user ?? gunUid;

Expand Down

0 comments on commit 50044a9

Please sign in to comment.