Content mapmanager query changes (#16894)
This commit is contained in:
@@ -39,13 +39,13 @@ public sealed class DecalPlacementOverlay : Overlay
|
||||
return;
|
||||
|
||||
// No map support for decals
|
||||
if (!_mapManager.TryFindGridAt(mousePos, out var grid))
|
||||
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var worldMatrix = _transform.GetWorldMatrix(grid.Owner);
|
||||
var invMatrix = _transform.GetInvWorldMatrix(grid.Owner);
|
||||
var worldMatrix = _transform.GetWorldMatrix(gridUid);
|
||||
var invMatrix = _transform.GetInvWorldMatrix(gridUid);
|
||||
|
||||
var handle = args.WorldHandle;
|
||||
handle.SetTransform(worldMatrix);
|
||||
|
||||
@@ -168,7 +168,8 @@ namespace Content.Client.Gameplay
|
||||
var mousePosWorld = vp.ScreenToMap(kArgs.PointerLocation.Position);
|
||||
entityToClick = GetClickedEntity(mousePosWorld);
|
||||
|
||||
coordinates = _mapManager.TryFindGridAt(mousePosWorld, out var grid) ? grid.MapToGrid(mousePosWorld) :
|
||||
coordinates = _mapManager.TryFindGridAt(mousePosWorld, out _, out var grid) ?
|
||||
grid.MapToGrid(mousePosWorld) :
|
||||
EntityCoordinates.FromMap(_mapManager, mousePosWorld);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,10 +97,10 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
|
||||
if (_dragging == null)
|
||||
{
|
||||
if (!_mapManager.TryFindGridAt(mousePos, out var grid))
|
||||
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
|
||||
return;
|
||||
|
||||
StartDragging(grid.Owner, Transform(grid.Owner).InvWorldMatrix.Transform(mousePos.Position));
|
||||
StartDragging(gridUid, Transform(gridUid).InvWorldMatrix.Transform(mousePos.Position));
|
||||
}
|
||||
|
||||
if (!TryComp<TransformComponent>(_dragging, out var xform))
|
||||
|
||||
@@ -253,12 +253,10 @@ namespace Content.Client.NPC
|
||||
if ((_system.Modes & PathfindingDebugMode.Poly) != 0x0 &&
|
||||
mouseWorldPos.MapId == args.MapId)
|
||||
{
|
||||
if (!_mapManager.TryFindGridAt(mouseWorldPos, out var grid) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
|
||||
if (!_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out var grid) || !xformQuery.TryGetComponent(gridUid, out var gridXform))
|
||||
return;
|
||||
|
||||
var found = false;
|
||||
|
||||
if (!_system.Polys.TryGetValue(grid.Owner, out var data))
|
||||
if (!_system.Polys.TryGetValue(gridUid, out var data))
|
||||
return;
|
||||
|
||||
var tileRef = grid.GetTileRef(mouseWorldPos);
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Content.Client.Sandbox
|
||||
}
|
||||
|
||||
// Try copy tile.
|
||||
if (!_map.TryFindGridAt(coords.ToMap(EntityManager), out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
|
||||
if (!_map.TryFindGridAt(coords.ToMap(EntityManager), out _, out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
|
||||
return false;
|
||||
|
||||
if (_placement.Eraser)
|
||||
|
||||
@@ -25,6 +25,7 @@ public sealed class RadarControl : MapGridControl
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
private SharedTransformSystem _transform = default!;
|
||||
|
||||
private const float GridLinesDistance = 32f;
|
||||
|
||||
@@ -50,8 +51,6 @@ public sealed class RadarControl : MapGridControl
|
||||
/// </summary>
|
||||
public EntityUid? HighlightedDock;
|
||||
|
||||
public Action<float>? OnRadarRangeChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raised if the user left-clicks on the radar control with the relevant entitycoordinates.
|
||||
/// </summary>
|
||||
@@ -59,7 +58,7 @@ public sealed class RadarControl : MapGridControl
|
||||
|
||||
public RadarControl() : base(64f, 256f, 256f)
|
||||
{
|
||||
|
||||
_transform = _entManager.System<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
|
||||
@@ -188,7 +187,7 @@ public sealed class RadarControl : MapGridControl
|
||||
|
||||
Matrix3.Multiply(in ourGridMatrix, in offsetMatrix, out var matrix);
|
||||
|
||||
DrawGrid(handle, matrix, ourFixturesComp, ourGrid, Color.MediumSpringGreen, true);
|
||||
DrawGrid(handle, matrix, ourGrid, Color.MediumSpringGreen, true);
|
||||
DrawDocks(handle, ourGridId.Value, matrix);
|
||||
}
|
||||
|
||||
@@ -287,7 +286,7 @@ public sealed class RadarControl : MapGridControl
|
||||
}
|
||||
|
||||
// Detailed view
|
||||
DrawGrid(handle, matty, fixturesComp, grid, color, true);
|
||||
DrawGrid(handle, matty, grid, color, true);
|
||||
|
||||
DrawDocks(handle, grid.Owner, matty);
|
||||
}
|
||||
@@ -358,7 +357,7 @@ public sealed class RadarControl : MapGridControl
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawGrid(DrawingHandleScreen handle, Matrix3 matrix, FixturesComponent fixturesComp, MapGridComponent grid, Color color, bool drawInterior)
|
||||
private void DrawGrid(DrawingHandleScreen handle, Matrix3 matrix, MapGridComponent grid, Color color, bool drawInterior)
|
||||
{
|
||||
var rator = grid.GetAllTilesEnumerator();
|
||||
var edges = new ValueList<Vector2>();
|
||||
|
||||
@@ -110,9 +110,9 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||
EntityCoordinates coordinates;
|
||||
|
||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||
if (MapManager.TryFindGridAt(mousePos, out var gridUid, out _))
|
||||
{
|
||||
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, TransformSystem, EntityManager);
|
||||
coordinates = EntityCoordinates.FromMap(gridUid, mousePos, TransformSystem, EntityManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -145,9 +145,9 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
|
||||
// Bro why would I want a ternary here
|
||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||
if (MapManager.TryFindGridAt(mousePos, out var gridUid, out _))
|
||||
{
|
||||
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, TransformSystem, EntityManager);
|
||||
coordinates = EntityCoordinates.FromMap(gridUid, mousePos, TransformSystem, EntityManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,9 +186,9 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
|
||||
// Bro why would I want a ternary here
|
||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||
if (MapManager.TryFindGridAt(mousePos, out var grid))
|
||||
if (MapManager.TryFindGridAt(mousePos, out var gridUid, out _))
|
||||
{
|
||||
coordinates = EntityCoordinates.FromMap(grid.Owner, mousePos, TransformSystem, EntityManager);
|
||||
coordinates = EntityCoordinates.FromMap(gridUid, mousePos, TransformSystem, EntityManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -71,9 +71,9 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
|
||||
|
||||
EntityCoordinates coords;
|
||||
|
||||
if (_mapManager.TryFindGridAt(mouseWorldPos, out var grid))
|
||||
if (_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out _))
|
||||
{
|
||||
coords = EntityCoordinates.FromMap(grid.Owner, mouseWorldPos, TransformSystem);
|
||||
coords = EntityCoordinates.FromMap(gridUid, mouseWorldPos, TransformSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user