Set input coords to invalid if mouse off-screen (#30164)

This may be a breaking change for some stuff, I only tested basic combat stuff + throwing.

This fixes the coordinates setting an off-screen position to the top-left pixel and blocks throw attempts as a result.
This commit is contained in:
metalgearsloth
2024-07-21 16:13:28 +10:00
committed by GitHub
parent 2c8dd58ad8
commit aca878c9f7
2 changed files with 6 additions and 2 deletions

View File

@@ -170,7 +170,7 @@ namespace Content.Server.Hands.Systems
private bool HandleThrowItem(ICommonSession? playerSession, EntityCoordinates coordinates, EntityUid entity)
{
if (playerSession?.AttachedEntity is not {Valid: true} player || !Exists(player))
if (playerSession?.AttachedEntity is not {Valid: true} player || !Exists(player) || !coordinates.IsValid(EntityManager))
return false;
return ThrowHeldItem(player, coordinates);