Content mapmanager query changes (#16894)
This commit is contained in:
@@ -39,13 +39,13 @@ public sealed class DecalPlacementOverlay : Overlay
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// No map support for decals
|
// No map support for decals
|
||||||
if (!_mapManager.TryFindGridAt(mousePos, out var grid))
|
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var worldMatrix = _transform.GetWorldMatrix(grid.Owner);
|
var worldMatrix = _transform.GetWorldMatrix(gridUid);
|
||||||
var invMatrix = _transform.GetInvWorldMatrix(grid.Owner);
|
var invMatrix = _transform.GetInvWorldMatrix(gridUid);
|
||||||
|
|
||||||
var handle = args.WorldHandle;
|
var handle = args.WorldHandle;
|
||||||
handle.SetTransform(worldMatrix);
|
handle.SetTransform(worldMatrix);
|
||||||
|
|||||||
@@ -168,7 +168,8 @@ namespace Content.Client.Gameplay
|
|||||||
var mousePosWorld = vp.ScreenToMap(kArgs.PointerLocation.Position);
|
var mousePosWorld = vp.ScreenToMap(kArgs.PointerLocation.Position);
|
||||||
entityToClick = GetClickedEntity(mousePosWorld);
|
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);
|
EntityCoordinates.FromMap(_mapManager, mousePosWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,10 +97,10 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
|||||||
|
|
||||||
if (_dragging == null)
|
if (_dragging == null)
|
||||||
{
|
{
|
||||||
if (!_mapManager.TryFindGridAt(mousePos, out var grid))
|
if (!_mapManager.TryFindGridAt(mousePos, out var gridUid, out var grid))
|
||||||
return;
|
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))
|
if (!TryComp<TransformComponent>(_dragging, out var xform))
|
||||||
|
|||||||
@@ -253,12 +253,10 @@ namespace Content.Client.NPC
|
|||||||
if ((_system.Modes & PathfindingDebugMode.Poly) != 0x0 &&
|
if ((_system.Modes & PathfindingDebugMode.Poly) != 0x0 &&
|
||||||
mouseWorldPos.MapId == args.MapId)
|
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;
|
return;
|
||||||
|
|
||||||
var found = false;
|
if (!_system.Polys.TryGetValue(gridUid, out var data))
|
||||||
|
|
||||||
if (!_system.Polys.TryGetValue(grid.Owner, out var data))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tileRef = grid.GetTileRef(mouseWorldPos);
|
var tileRef = grid.GetTileRef(mouseWorldPos);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace Content.Client.Sandbox
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try copy tile.
|
// 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;
|
return false;
|
||||||
|
|
||||||
if (_placement.Eraser)
|
if (_placement.Eraser)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public sealed class RadarControl : MapGridControl
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
private SharedTransformSystem _transform = default!;
|
||||||
|
|
||||||
private const float GridLinesDistance = 32f;
|
private const float GridLinesDistance = 32f;
|
||||||
|
|
||||||
@@ -50,8 +51,6 @@ public sealed class RadarControl : MapGridControl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityUid? HighlightedDock;
|
public EntityUid? HighlightedDock;
|
||||||
|
|
||||||
public Action<float>? OnRadarRangeChanged;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised if the user left-clicks on the radar control with the relevant entitycoordinates.
|
/// Raised if the user left-clicks on the radar control with the relevant entitycoordinates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -59,7 +58,7 @@ public sealed class RadarControl : MapGridControl
|
|||||||
|
|
||||||
public RadarControl() : base(64f, 256f, 256f)
|
public RadarControl() : base(64f, 256f, 256f)
|
||||||
{
|
{
|
||||||
|
_transform = _entManager.System<SharedTransformSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
|
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);
|
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);
|
DrawDocks(handle, ourGridId.Value, matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +286,7 @@ public sealed class RadarControl : MapGridControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Detailed view
|
// Detailed view
|
||||||
DrawGrid(handle, matty, fixturesComp, grid, color, true);
|
DrawGrid(handle, matty, grid, color, true);
|
||||||
|
|
||||||
DrawDocks(handle, grid.Owner, matty);
|
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 rator = grid.GetAllTilesEnumerator();
|
||||||
var edges = new ValueList<Vector2>();
|
var edges = new ValueList<Vector2>();
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||||
EntityCoordinates coordinates;
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -145,9 +145,9 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
|
|
||||||
// Bro why would I want a ternary here
|
// Bro why would I want a ternary here
|
||||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
// 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
|
else
|
||||||
{
|
{
|
||||||
@@ -186,9 +186,9 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
|
|
||||||
// Bro why would I want a ternary here
|
// Bro why would I want a ternary here
|
||||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
|
|||||||
|
|
||||||
EntityCoordinates coords;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ public abstract partial class InteractionTest
|
|||||||
var pos = (coords ?? TargetCoords).ToMap(SEntMan, Transform);
|
var pos = (coords ?? TargetCoords).ToMap(SEntMan, Transform);
|
||||||
await Server.WaitPost(() =>
|
await Server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
if (MapMan.TryFindGridAt(pos, out var grid))
|
if (MapMan.TryFindGridAt(pos, out _, out var grid))
|
||||||
tile = grid.GetTileRef(coords ?? TargetCoords).Tile;
|
tile = grid.GetTileRef(coords ?? TargetCoords).Tile;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -663,7 +663,7 @@ public abstract partial class InteractionTest
|
|||||||
|
|
||||||
await Server.WaitPost(() =>
|
await Server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
if (grid != null || MapMan.TryFindGridAt(pos, out grid))
|
if (grid != null || MapMan.TryFindGridAt(pos, out var gridUid, out grid))
|
||||||
{
|
{
|
||||||
grid.SetTile(coords ?? TargetCoords, tile);
|
grid.SetTile(coords ?? TargetCoords, tile);
|
||||||
return;
|
return;
|
||||||
@@ -673,11 +673,12 @@ public abstract partial class InteractionTest
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
grid = MapMan.CreateGrid(MapData.MapId);
|
grid = MapMan.CreateGrid(MapData.MapId);
|
||||||
var gridXform = SEntMan.GetComponent<TransformComponent>(grid.Owner);
|
gridUid = grid.Owner;
|
||||||
|
var gridXform = SEntMan.GetComponent<TransformComponent>(gridUid);
|
||||||
Transform.SetWorldPosition(gridXform, pos.Position);
|
Transform.SetWorldPosition(gridXform, pos.Position);
|
||||||
grid.SetTile(coords ?? TargetCoords, tile);
|
grid.SetTile(coords ?? TargetCoords, tile);
|
||||||
|
|
||||||
if (!MapMan.TryFindGridAt(pos, out grid))
|
if (!MapMan.TryFindGridAt(pos, out _, out grid))
|
||||||
Assert.Fail("Failed to create grid?");
|
Assert.Fail("Failed to create grid?");
|
||||||
});
|
});
|
||||||
await AssertTile(proto, coords);
|
await AssertTile(proto, coords);
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(10, 10), out var mapGrid) ||
|
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(10, 10), out var gridUid, out var mapGrid) ||
|
||||||
!sEntities.TryGetComponent<TransformComponent>(mapGrid.Owner, out var gridXform))
|
!sEntities.TryGetComponent<TransformComponent>(gridUid, out var gridXform))
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
Assert.Fail();
|
||||||
return;
|
return;
|
||||||
@@ -80,8 +80,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(1, (TileRenderFlag)1, 255)));
|
Assert.That(mapGrid.GetTileRef(new Vector2i(0, 0)).Tile, Is.EqualTo(new Tile(1, (TileRenderFlag)1, 255)));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var mapGrid) ||
|
if (!mapManager.TryFindGridAt(new MapId(10), new Vector2(-8, -8), out var gridUid, out var mapGrid) ||
|
||||||
!sEntities.TryGetComponent<TransformComponent>(mapGrid.Owner, out var gridXform))
|
!sEntities.TryGetComponent<TransformComponent>(gridUid, out var gridXform))
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
Assert.Fail();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ public sealed class ProjectileAnomalySystem : EntitySystem
|
|||||||
{
|
{
|
||||||
var mapPos = coords.ToMap(EntityManager, _xform);
|
var mapPos = coords.ToMap(EntityManager, _xform);
|
||||||
|
|
||||||
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var grid)
|
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var gridUid, out _)
|
||||||
? coords.WithEntityId(grid.Owner, EntityManager)
|
? coords.WithEntityId(gridUid, EntityManager)
|
||||||
: new(_mapManager.GetMapEntityId(mapPos.MapId), mapPos.Position);
|
: new(_mapManager.GetMapEntityId(mapPos.MapId), mapPos.Position);
|
||||||
|
|
||||||
var ent = Spawn(component.ProjectilePrototype, spawnCoords);
|
var ent = Spawn(component.ProjectilePrototype, spawnCoords);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public sealed class BeamSystem : SharedBeamSystem
|
|||||||
|
|
||||||
_physics.SetBodyType(ent, BodyType.Dynamic, manager: manager, body: physics);
|
_physics.SetBodyType(ent, BodyType.Dynamic, manager: manager, body: physics);
|
||||||
_physics.SetCanCollide(ent, true, manager: manager, body: physics);
|
_physics.SetCanCollide(ent, true, manager: manager, body: physics);
|
||||||
_broadphase.RegenerateContacts(physics, manager);
|
_broadphase.RegenerateContacts(ent, physics, manager);
|
||||||
|
|
||||||
var beamVisualizerEvent = new BeamVisualizerEvent(ent, distanceLength, userAngle, bodyState, shader);
|
var beamVisualizerEvent = new BeamVisualizerEvent(ent, distanceLength, userAngle, bodyState, shader);
|
||||||
RaiseNetworkEvent(beamVisualizerEvent);
|
RaiseNetworkEvent(beamVisualizerEvent);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
if (!mapManager.TryFindGridAt(transform.MapPosition, out var grid) ||
|
if (!mapManager.TryFindGridAt(transform.MapPosition, out _, out var grid) ||
|
||||||
!grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
|
!grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
|
||||||
tileRef.Tile.IsSpace())
|
tileRef.Tile.IsSpace())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
var (localGrids, referenceGrid, maxDistance) = GetLocalGrids(epicenter, totalIntensity, slope, maxIntensity);
|
var (localGrids, referenceGrid, maxDistance) = GetLocalGrids(epicenter, totalIntensity, slope, maxIntensity);
|
||||||
|
|
||||||
// get the epicenter tile indices
|
// get the epicenter tile indices
|
||||||
if (_mapManager.TryFindGridAt(epicenter, out var candidateGrid) &&
|
if (_mapManager.TryFindGridAt(epicenter, out var gridUid, out var candidateGrid) &&
|
||||||
candidateGrid.TryGetTileRef(candidateGrid.WorldToTile(epicenter.Position), out var tileRef) &&
|
candidateGrid.TryGetTileRef(candidateGrid.WorldToTile(epicenter.Position), out var tileRef) &&
|
||||||
!tileRef.Tile.IsEmpty)
|
!tileRef.Tile.IsEmpty)
|
||||||
{
|
{
|
||||||
epicentreGrid = candidateGrid.Owner;
|
epicentreGrid = gridUid;
|
||||||
initialTile = tileRef.GridIndices;
|
initialTile = tileRef.GridIndices;
|
||||||
}
|
}
|
||||||
else if (referenceGrid != null)
|
else if (referenceGrid != null)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public sealed partial class TriggerSystem
|
|||||||
// Re-check for contacts as we cleared them.
|
// Re-check for contacts as we cleared them.
|
||||||
else if (TryComp<PhysicsComponent>(uid, out var body))
|
else if (TryComp<PhysicsComponent>(uid, out var body))
|
||||||
{
|
{
|
||||||
_broadphase.RegenerateContacts(body);
|
_broadphase.RegenerateContacts(uid, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -342,11 +342,11 @@ namespace Content.Server.GameTicking
|
|||||||
var spawn = _robustRandom.Pick(_possiblePositions);
|
var spawn = _robustRandom.Pick(_possiblePositions);
|
||||||
var toMap = spawn.ToMap(EntityManager);
|
var toMap = spawn.ToMap(EntityManager);
|
||||||
|
|
||||||
if (_mapManager.TryFindGridAt(toMap, out var foundGrid))
|
if (_mapManager.TryFindGridAt(toMap, out var gridUid, out _))
|
||||||
{
|
{
|
||||||
var gridXform = Transform(foundGrid.Owner);
|
var gridXform = Transform(gridUid);
|
||||||
|
|
||||||
return new EntityCoordinates(foundGrid.Owner,
|
return new EntityCoordinates(gridUid,
|
||||||
gridXform.InvWorldMatrix.Transform(toMap.Position));
|
gridXform.InvWorldMatrix.Transform(toMap.Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,8 +167,8 @@ public sealed class MagicSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
|
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
|
||||||
var mapPos = pos.ToMap(EntityManager);
|
var mapPos = pos.ToMap(EntityManager);
|
||||||
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var grid)
|
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var gridUid, out _)
|
||||||
? pos.WithEntityId(grid.Owner, EntityManager)
|
? pos.WithEntityId(gridUid, EntityManager)
|
||||||
: new(_mapManager.GetMapEntityId(mapPos.MapId), mapPos.Position);
|
: new(_mapManager.GetMapEntityId(mapPos.MapId), mapPos.Position);
|
||||||
|
|
||||||
var ent = Spawn(ev.Prototype, spawnCoords);
|
var ent = Spawn(ev.Prototype, spawnCoords);
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ public sealed class MechSystem : SharedMechSystem
|
|||||||
if (component.Airtight && TryComp(uid, out MechAirComponent? mechAir))
|
if (component.Airtight && TryComp(uid, out MechAirComponent? mechAir))
|
||||||
{
|
{
|
||||||
var coordinates = Transform(uid).MapPosition;
|
var coordinates = Transform(uid).MapPosition;
|
||||||
if (_map.TryFindGridAt(coordinates, out var grid))
|
if (_map.TryFindGridAt(coordinates, out _, out var grid))
|
||||||
{
|
{
|
||||||
var tile = grid.GetTileRef(coordinates);
|
var tile = grid.GetTileRef(coordinates);
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ public sealed class MechSystem : SharedMechSystem
|
|||||||
if (component.Airtight && TryComp(uid, out MechAirComponent? mechAir))
|
if (component.Airtight && TryComp(uid, out MechAirComponent? mechAir))
|
||||||
{
|
{
|
||||||
var coordinates = Transform(uid).MapPosition;
|
var coordinates = Transform(uid).MapPosition;
|
||||||
if (_map.TryFindGridAt(coordinates, out var grid))
|
if (_map.TryFindGridAt(coordinates, out _, out var grid))
|
||||||
{
|
{
|
||||||
var tile = grid.GetTileRef(coordinates);
|
var tile = grid.GetTileRef(coordinates);
|
||||||
|
|
||||||
|
|||||||
@@ -145,9 +145,9 @@ public sealed partial class NPCCombatSystem
|
|||||||
|
|
||||||
EntityCoordinates targetCordinates;
|
EntityCoordinates targetCordinates;
|
||||||
|
|
||||||
if (_mapManager.TryFindGridAt(xform.MapID, targetPos, out var mapGrid))
|
if (_mapManager.TryFindGridAt(xform.MapID, targetPos, out var gridUid, out var mapGrid))
|
||||||
{
|
{
|
||||||
targetCordinates = new EntityCoordinates(mapGrid.Owner, mapGrid.WorldToLocal(targetSpot));
|
targetCordinates = new EntityCoordinates(gridUid, mapGrid.WorldToLocal(targetSpot));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public sealed class ConveyorController : SharedConveyorController
|
|||||||
component.State = state;
|
component.State = state;
|
||||||
|
|
||||||
if (TryComp<PhysicsComponent>(uid, out var physics))
|
if (TryComp<PhysicsComponent>(uid, out var physics))
|
||||||
_broadphase.RegenerateContacts(physics);
|
_broadphase.RegenerateContacts(uid, physics);
|
||||||
|
|
||||||
_materialReclaimer.SetReclaimerEnabled(uid, component.State != ConveyorState.Off);
|
_materialReclaimer.SetReclaimerEnabled(uid, component.State != ConveyorState.Off);
|
||||||
|
|
||||||
|
|||||||
@@ -207,9 +207,9 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
TileRef? tileRef = null;
|
TileRef? tileRef = null;
|
||||||
string? position = null;
|
string? position = null;
|
||||||
|
|
||||||
if (_mapManager.TryFindGridAt(mapCoords, out var grid))
|
if (_mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid))
|
||||||
{
|
{
|
||||||
position = $"EntId={grid.Owner} {grid.WorldToTile(mapCoords.Position)}";
|
position = $"EntId={gridUid} {grid.WorldToTile(mapCoords.Position)}";
|
||||||
tileRef = grid.GetTileRef(grid.WorldToTile(mapCoords.Position));
|
tileRef = grid.GetTileRef(grid.WorldToTile(mapCoords.Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem
|
|||||||
{
|
{
|
||||||
var targetCoordinates = new EntityCoordinates(uid, component.EnteringOffset).ToMap(EntityManager);
|
var targetCoordinates = new EntityCoordinates(uid, component.EnteringOffset).ToMap(EntityManager);
|
||||||
|
|
||||||
if (_map.TryFindGridAt(targetCoordinates, out var grid))
|
if (_map.TryFindGridAt(targetCoordinates, out _, out var grid))
|
||||||
{
|
{
|
||||||
return grid.GetTileRef(targetCoordinates);
|
return grid.GetTileRef(targetCoordinates);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public sealed partial class ToolSystem
|
|||||||
|
|
||||||
private bool TryCut(EntityUid toolEntity, EntityUid user, LatticeCuttingComponent component, EntityCoordinates clickLocation)
|
private bool TryCut(EntityUid toolEntity, EntityUid user, LatticeCuttingComponent component, EntityCoordinates clickLocation)
|
||||||
{
|
{
|
||||||
if (!_mapManager.TryFindGridAt(clickLocation.ToMap(EntityManager, _transformSystem), out var mapGrid))
|
if (!_mapManager.TryFindGridAt(clickLocation.ToMap(EntityManager, _transformSystem), out _, out var mapGrid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var tile = mapGrid.GetTileRef(clickLocation);
|
var tile = mapGrid.GetTileRef(clickLocation);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public sealed partial class ToolSystem
|
|||||||
if (!TryComp<ToolComponent?>(toolEntity, out var tool) && component.ToolComponentNeeded)
|
if (!TryComp<ToolComponent?>(toolEntity, out var tool) && component.ToolComponentNeeded)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!_mapManager.TryFindGridAt(clickLocation.ToMap(EntityManager, _transformSystem), out var mapGrid))
|
if (!_mapManager.TryFindGridAt(clickLocation.ToMap(EntityManager, _transformSystem), out _, out var mapGrid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var tile = mapGrid.GetTileRef(clickLocation);
|
var tile = mapGrid.GetTileRef(clickLocation);
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
var angle = GetRecoilAngle(Timing.CurTime, gun, mapDirection.ToAngle());
|
var angle = GetRecoilAngle(Timing.CurTime, gun, mapDirection.ToAngle());
|
||||||
|
|
||||||
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
|
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
|
||||||
var fromEnt = MapManager.TryFindGridAt(fromMap, out var grid)
|
var fromEnt = MapManager.TryFindGridAt(fromMap, out var gridUid, out var grid)
|
||||||
? fromCoordinates.WithEntityId(grid.Owner, EntityManager)
|
? fromCoordinates.WithEntityId(gridUid, EntityManager)
|
||||||
: new EntityCoordinates(MapManager.GetMapEntityId(fromMap.MapId), fromMap.Position);
|
: new EntityCoordinates(MapManager.GetMapEntityId(fromMap.MapId), fromMap.Position);
|
||||||
|
|
||||||
// Update shot based on the recoil
|
// Update shot based on the recoil
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Content.Shared.Construction
|
|||||||
if (!canBuildInImpassable)
|
if (!canBuildInImpassable)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!_mapManager.TryFindGridAt(coords, out var grid))
|
if (!_mapManager.TryFindGridAt(coords, out _, out var grid))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var ignored = grid.GetAnchoredEntities(coords).ToHashSet();
|
var ignored = grid.GetAnchoredEntities(coords).ToHashSet();
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ namespace Content.Shared.Interaction
|
|||||||
ignoreAnchored = angleDelta < wallMount.Arc / 2 || Math.Tau - angleDelta < wallMount.Arc / 2;
|
ignoreAnchored = angleDelta < wallMount.Arc / 2 || Math.Tau - angleDelta < wallMount.Arc / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ignoreAnchored && _mapManager.TryFindGridAt(targetCoords, out var grid))
|
if (ignoreAnchored && _mapManager.TryFindGridAt(targetCoords, out _, out var grid))
|
||||||
ignored.UnionWith(grid.GetAnchoredEntities(targetCoords));
|
ignored.UnionWith(grid.GetAnchoredEntities(targetCoords));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Content.Shared.Maps
|
|||||||
|
|
||||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
mapManager ??= IoCManager.Resolve<IMapManager>();
|
||||||
var pos = coordinates.ToMap(entityManager, entityManager.System<SharedTransformSystem>());
|
var pos = coordinates.ToMap(entityManager, entityManager.System<SharedTransformSystem>());
|
||||||
if (!mapManager.TryFindGridAt(pos, out var grid))
|
if (!mapManager.TryFindGridAt(pos, out _, out var grid))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!grid.TryGetTileRef(coordinates, out var tile))
|
if (!grid.TryGetTileRef(coordinates, out var tile))
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace Content.Shared.Throwing
|
|||||||
if (thrownItem.Thrower is not null)
|
if (thrownItem.Thrower is not null)
|
||||||
_adminLogger.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(landing):entity} thrown by {ToPrettyString(thrownItem.Thrower.Value):thrower} landed.");
|
_adminLogger.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(landing):entity} thrown by {ToPrettyString(thrownItem.Thrower.Value):thrower} landed.");
|
||||||
|
|
||||||
_broadphase.RegenerateContacts(physics);
|
_broadphase.RegenerateContacts(uid, physics);
|
||||||
var landEvent = new LandEvent(thrownItem.Thrower, playSound);
|
var landEvent = new LandEvent(thrownItem.Thrower, playSound);
|
||||||
RaiseLocalEvent(landing, ref landEvent);
|
RaiseLocalEvent(landing, ref landEvent);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user