- fix: Shooting now uses grid velocity. (#8)

This commit is contained in:
Aviu00
2024-01-31 21:48:39 +09:00
committed by GitHub
parent 27d4cf977f
commit 50e6b26514
2 changed files with 19 additions and 3 deletions

View File

@@ -115,7 +115,14 @@ public sealed partial class GunSystem : SharedGunSystem
// Update shot based on the recoil
toMap = fromMap.Position + angle.ToVec() * mapDirection.Length();
mapDirection = toMap - fromMap.Position;
var gunVelocity = Physics.GetMapLinearVelocity(gunUid);
// WD EDIT START
// var gunVelocity = Physics.GetMapLinearVelocity(gunUid);
var gunVelocity = Vector2.Zero;
if (grid != null && TryComp(gridUid, out PhysicsComponent? physics))
gunVelocity = physics.LinearVelocity;
// WD EDIT END
// I must be high because this was getting tripped even when true.
// DebugTools.Assert(direction != Vector2.Zero);