Don't swing out of range (#11964)

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2022-10-17 02:54:43 +11:00
committed by GitHub
parent 20f68d156e
commit 85926cf209

View File

@@ -165,6 +165,14 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
}
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
var attackerPos = Transform(entity).MapPosition;
if (mousePos.MapId != attackerPos.MapId ||
(attackerPos.Position - mousePos.Position).Length > weapon.Range)
{
return;
}
EntityCoordinates coordinates;
// Bro why would I want a ternary here