Content mapmanager query changes (#16894)
This commit is contained in:
@@ -74,8 +74,8 @@ public sealed class ProjectileAnomalySystem : EntitySystem
|
||||
{
|
||||
var mapPos = coords.ToMap(EntityManager, _xform);
|
||||
|
||||
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var grid)
|
||||
? coords.WithEntityId(grid.Owner, EntityManager)
|
||||
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var gridUid, out _)
|
||||
? coords.WithEntityId(gridUid, EntityManager)
|
||||
: new(_mapManager.GetMapEntityId(mapPos.MapId), mapPos.Position);
|
||||
|
||||
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.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);
|
||||
RaiseNetworkEvent(beamVisualizerEvent);
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||
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) ||
|
||||
tileRef.Tile.IsSpace())
|
||||
{
|
||||
|
||||
@@ -44,11 +44,11 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
var (localGrids, referenceGrid, maxDistance) = GetLocalGrids(epicenter, totalIntensity, slope, maxIntensity);
|
||||
|
||||
// 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) &&
|
||||
!tileRef.Tile.IsEmpty)
|
||||
{
|
||||
epicentreGrid = candidateGrid.Owner;
|
||||
epicentreGrid = gridUid;
|
||||
initialTile = tileRef.GridIndices;
|
||||
}
|
||||
else if (referenceGrid != null)
|
||||
|
||||
@@ -43,7 +43,7 @@ public sealed partial class TriggerSystem
|
||||
// Re-check for contacts as we cleared them.
|
||||
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 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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
var mapPos = pos.ToMap(EntityManager);
|
||||
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var grid)
|
||||
? pos.WithEntityId(grid.Owner, EntityManager)
|
||||
var spawnCoords = _mapManager.TryFindGridAt(mapPos, out var gridUid, out _)
|
||||
? pos.WithEntityId(gridUid, EntityManager)
|
||||
: new(_mapManager.GetMapEntityId(mapPos.MapId), mapPos.Position);
|
||||
|
||||
var ent = Spawn(ev.Prototype, spawnCoords);
|
||||
|
||||
@@ -306,7 +306,7 @@ public sealed class MechSystem : SharedMechSystem
|
||||
if (component.Airtight && TryComp(uid, out MechAirComponent? mechAir))
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -330,7 +330,7 @@ public sealed class MechSystem : SharedMechSystem
|
||||
if (component.Airtight && TryComp(uid, out MechAirComponent? mechAir))
|
||||
{
|
||||
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);
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ public sealed partial class NPCCombatSystem
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ public sealed class ConveyorController : SharedConveyorController
|
||||
component.State = state;
|
||||
|
||||
if (TryComp<PhysicsComponent>(uid, out var physics))
|
||||
_broadphase.RegenerateContacts(physics);
|
||||
_broadphase.RegenerateContacts(uid, physics);
|
||||
|
||||
_materialReclaimer.SetReclaimerEnabled(uid, component.State != ConveyorState.Off);
|
||||
|
||||
|
||||
@@ -207,9 +207,9 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
TileRef? tileRef = 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));
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public sealed partial class ToolSystem
|
||||
|
||||
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;
|
||||
|
||||
var tile = mapGrid.GetTileRef(clickLocation);
|
||||
|
||||
@@ -52,7 +52,7 @@ public sealed partial class ToolSystem
|
||||
if (!TryComp<ToolComponent?>(toolEntity, out var tool) && component.ToolComponentNeeded)
|
||||
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;
|
||||
|
||||
var tile = mapGrid.GetTileRef(clickLocation);
|
||||
|
||||
@@ -103,8 +103,8 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
var angle = GetRecoilAngle(Timing.CurTime, gun, mapDirection.ToAngle());
|
||||
|
||||
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
|
||||
var fromEnt = MapManager.TryFindGridAt(fromMap, out var grid)
|
||||
? fromCoordinates.WithEntityId(grid.Owner, EntityManager)
|
||||
var fromEnt = MapManager.TryFindGridAt(fromMap, out var gridUid, out var grid)
|
||||
? fromCoordinates.WithEntityId(gridUid, EntityManager)
|
||||
: new EntityCoordinates(MapManager.GetMapEntityId(fromMap.MapId), fromMap.Position);
|
||||
|
||||
// Update shot based on the recoil
|
||||
|
||||
Reference in New Issue
Block a user