"Fix" aghost mass scanner (#9438)
This commit is contained in:
@@ -145,33 +145,30 @@ public sealed class RadarControl : Control
|
||||
|
||||
var mapPosition = _coordinates.Value.ToMap(_entManager);
|
||||
|
||||
if (mapPosition.MapId == MapId.Nullspace)
|
||||
if (mapPosition.MapId == MapId.Nullspace || !xformQuery.TryGetComponent(_coordinates.Value.EntityId, out var xform))
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
var offset = _coordinates.Value.Position;
|
||||
Matrix3 matrix;
|
||||
var offsetMatrix = Matrix3.CreateInverseTransform(
|
||||
mapPosition.Position,
|
||||
xform.WorldRotation - _rotation.Value);
|
||||
|
||||
// Draw our grid in detail
|
||||
var ourGridId = _coordinates.Value.GetGridUid(_entManager);
|
||||
if (ourGridId != null)
|
||||
{
|
||||
var offsetMatrix = Matrix3.CreateInverseTransform(offset.X, offset.Y, (float) _rotation.Value.Theta);
|
||||
var ourGridMatrix = xformQuery.GetComponent(ourGridId.Value).WorldMatrix;
|
||||
var ourGridFixtures = fixturesQuery.GetComponent(ourGridId.Value);
|
||||
|
||||
Matrix3.Multiply(in ourGridMatrix, in offsetMatrix, out var matrix);
|
||||
|
||||
// Draw our grid; use non-filled boxes so it doesn't look awful.
|
||||
DrawGrid(handle, offsetMatrix, ourGridFixtures, Color.Yellow);
|
||||
DrawGrid(handle, matrix, ourGridFixtures, Color.Yellow);
|
||||
|
||||
DrawDocks(handle, ourGridId.Value, offsetMatrix);
|
||||
|
||||
var ourGridMatrix = xformQuery.GetComponent(ourGridId.Value).InvWorldMatrix;
|
||||
|
||||
Matrix3.Multiply(in ourGridMatrix, in offsetMatrix, out matrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix = Matrix3.CreateTranslation(-offset);
|
||||
DrawDocks(handle, ourGridId.Value, matrix);
|
||||
}
|
||||
|
||||
var invertedPosition = _coordinates.Value.Position - offset;
|
||||
@@ -205,7 +202,7 @@ public sealed class RadarControl : Control
|
||||
var gridXform = xformQuery.GetComponent(grid.GridEntityId);
|
||||
var gridFixtures = fixturesQuery.GetComponent(grid.GridEntityId);
|
||||
var gridMatrix = gridXform.WorldMatrix;
|
||||
Matrix3.Multiply(in gridMatrix, in matrix, out var matty);
|
||||
Matrix3.Multiply(in gridMatrix, in offsetMatrix, out var matty);
|
||||
|
||||
if (ShowIFF)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user