Silence ScreenToWorld warnings (#1098)
This fixes one case of GridCoordinates being used unnecessarily, in GameScreenBase. It replaces other cases with explicit calls to TryFindGridAt and GetDefaultGrid.
This commit is contained in:
@@ -6,6 +6,7 @@ using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
@@ -18,6 +19,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPlayerManager _playerManager;
|
||||
[Dependency] private readonly IEyeManager _eyeManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IInputManager _inputManager;
|
||||
[Dependency] private readonly IGameTiming _gameTiming;
|
||||
#pragma warning restore 649
|
||||
@@ -74,11 +76,14 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
var worldPos = _eyeManager.ScreenToWorld(_inputManager.MouseScreenPosition);
|
||||
var worldPos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||
|
||||
if (!_mapManager.TryFindGridAt(worldPos, out var grid))
|
||||
grid = _mapManager.GetDefaultGrid(worldPos.MapId);
|
||||
|
||||
if (weapon.Automatic || canFireSemi)
|
||||
{
|
||||
weapon.SyncFirePos(worldPos);
|
||||
weapon.SyncFirePos(grid.MapToGrid(worldPos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user