Replace obsolete FromMap calls with ToCoordinates (#35304)
This commit is contained in:
@@ -219,10 +219,12 @@ namespace Content.Client.Gameplay
|
|||||||
{
|
{
|
||||||
entityToClick = GetClickedEntity(mousePosWorld);
|
entityToClick = GetClickedEntity(mousePosWorld);
|
||||||
}
|
}
|
||||||
|
var transformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
|
||||||
|
var mapSystem = _entitySystemManager.GetEntitySystem<MapSystem>();
|
||||||
|
|
||||||
coordinates = _mapManager.TryFindGridAt(mousePosWorld, out _, out var grid) ?
|
coordinates = _mapManager.TryFindGridAt(mousePosWorld, out var uid, out _) ?
|
||||||
grid.MapToGrid(mousePosWorld) :
|
mapSystem.MapToGrid(uid, mousePosWorld) :
|
||||||
EntityCoordinates.FromMap(_mapManager, mousePosWorld);
|
transformSystem.ToCoordinates(mousePosWorld);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
|
|||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IOverlayManager _overlay = default!;
|
[Dependency] private readonly IOverlayManager _overlay = default!;
|
||||||
[Dependency] private readonly IPlayerManager _player = default!;
|
[Dependency] private readonly IPlayerManager _player = default!;
|
||||||
|
[Dependency] private readonly MapSystem _mapSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -73,11 +74,11 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
|
|||||||
|
|
||||||
if (_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out _))
|
if (_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out _))
|
||||||
{
|
{
|
||||||
coords = EntityCoordinates.FromMap(gridUid, mouseWorldPos, TransformSystem);
|
coords = TransformSystem.ToCoordinates(gridUid, mouseWorldPos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
coords = EntityCoordinates.FromMap(_mapManager.GetMapEntityId(mouseWorldPos.MapId), mouseWorldPos, TransformSystem);
|
coords = TransformSystem.ToCoordinates(_mapSystem.GetMap(mouseWorldPos.MapId), mouseWorldPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float BufferDistance = 0.1f;
|
const float BufferDistance = 0.1f;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
Filter.PvsExcept(args.Target), true, PopupType.MediumCaution);
|
Filter.PvsExcept(args.Target), true, PopupType.MediumCaution);
|
||||||
var board = Spawn("ChessBoard", xform.Coordinates);
|
var board = Spawn("ChessBoard", xform.Coordinates);
|
||||||
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
|
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
|
||||||
xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
|
xform.Coordinates = _transformSystem.ToCoordinates(session.Position);
|
||||||
_transformSystem.SetWorldRotationNoLerp((args.Target, xform), Angle.Zero);
|
_transformSystem.SetWorldRotationNoLerp((args.Target, xform), Angle.Zero);
|
||||||
},
|
},
|
||||||
Impact = LogImpact.Extreme,
|
Impact = LogImpact.Extreme,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Content.Shared.GameTicking;
|
|||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Projectiles;
|
using Content.Shared.Projectiles;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameStates;
|
using Robust.Server.GameStates;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
@@ -38,6 +39,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
|||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
|
[Dependency] private readonly MapSystem _mapSystem = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||||
[Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!;
|
[Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!;
|
||||||
@@ -345,7 +347,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
|||||||
CameraShake(iterationIntensity.Count * 4f, pos, queued.TotalIntensity);
|
CameraShake(iterationIntensity.Count * 4f, pos, queued.TotalIntensity);
|
||||||
|
|
||||||
//For whatever bloody reason, sound system requires ENTITY coordinates.
|
//For whatever bloody reason, sound system requires ENTITY coordinates.
|
||||||
var mapEntityCoords = EntityCoordinates.FromMap(_mapManager.GetMapEntityId(pos.MapId), pos, _transformSystem, EntityManager);
|
var mapEntityCoords = _transformSystem.ToCoordinates(_mapSystem.GetMap(pos.MapId), pos);
|
||||||
|
|
||||||
// play sound.
|
// play sound.
|
||||||
// for the normal audio, we want everyone in pvs range
|
// for the normal audio, we want everyone in pvs range
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ namespace Content.Shared.Coordinates.Helpers
|
|||||||
if (gridId == null)
|
if (gridId == null)
|
||||||
{
|
{
|
||||||
var xformSys = entMan.System<SharedTransformSystem>();
|
var xformSys = entMan.System<SharedTransformSystem>();
|
||||||
var mapPos = coordinates.ToMap(entMan, xformSys);
|
var mapPos = xformSys.ToMapCoordinates(coordinates);
|
||||||
var mapX = (int)Math.Floor(mapPos.X) + 0.5f;
|
var mapX = (int)Math.Floor(mapPos.X) + 0.5f;
|
||||||
var mapY = (int)Math.Floor(mapPos.Y) + 0.5f;
|
var mapY = (int)Math.Floor(mapPos.Y) + 0.5f;
|
||||||
mapPos = new MapCoordinates(new Vector2(mapX, mapY), mapPos.MapId);
|
mapPos = new MapCoordinates(new Vector2(mapX, mapY), mapPos.MapId);
|
||||||
return EntityCoordinates.FromMap(coordinates.EntityId, mapPos, xformSys);
|
return xformSys.ToCoordinates(coordinates.EntityId, mapPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
var grid = entMan.GetComponent<MapGridComponent>(gridId.Value);
|
var grid = entMan.GetComponent<MapGridComponent>(gridId.Value);
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
|||||||
&& (itemPos.Position - TransformSystem.GetMapCoordinates(uid, xform: xform).Position).Length() <= MaxAnimationRange
|
&& (itemPos.Position - TransformSystem.GetMapCoordinates(uid, xform: xform).Position).Length() <= MaxAnimationRange
|
||||||
&& MetaData(entity).VisibilityMask == MetaData(uid).VisibilityMask) // Don't animate aghost pickups.
|
&& MetaData(entity).VisibilityMask == MetaData(uid).VisibilityMask) // Don't animate aghost pickups.
|
||||||
{
|
{
|
||||||
var initialPosition = EntityCoordinates.FromMap(coordinateEntity, itemPos, TransformSystem, EntityManager);
|
var initialPosition = TransformSystem.ToCoordinates(coordinateEntity, itemPos);
|
||||||
_storage.PlayPickupAnimation(entity, initialPosition, xform.Coordinates, itemXform.LocalRotation, uid);
|
_storage.PlayPickupAnimation(entity, initialPosition, xform.Coordinates, itemXform.LocalRotation, uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public sealed class MagnetPickupSystem : EntitySystem
|
|||||||
// game state handling we can't show a lerp animation for it.
|
// game state handling we can't show a lerp animation for it.
|
||||||
var nearXform = Transform(near);
|
var nearXform = Transform(near);
|
||||||
var nearMap = _transform.GetMapCoordinates(near, xform: nearXform);
|
var nearMap = _transform.GetMapCoordinates(near, xform: nearXform);
|
||||||
var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager);
|
var nearCoords = _transform.ToCoordinates(moverCoords.EntityId, nearMap);
|
||||||
|
|
||||||
if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound))
|
if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -532,10 +532,9 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
var parent = transformOwner.ParentUid;
|
var parent = transformOwner.ParentUid;
|
||||||
|
|
||||||
var position = EntityCoordinates.FromMap(
|
var position = TransformSystem.ToCoordinates(
|
||||||
parent.IsValid() ? parent : uid,
|
parent.IsValid() ? parent : uid,
|
||||||
TransformSystem.GetMapCoordinates(transformEnt),
|
TransformSystem.GetMapCoordinates(transformEnt)
|
||||||
TransformSystem
|
|
||||||
);
|
);
|
||||||
|
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
@@ -585,10 +584,9 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var position = EntityCoordinates.FromMap(
|
var position = TransformSystem.ToCoordinates(
|
||||||
xform.ParentUid.IsValid() ? xform.ParentUid : uid,
|
xform.ParentUid.IsValid() ? xform.ParentUid : uid,
|
||||||
new MapCoordinates(TransformSystem.GetWorldPosition(targetXform), targetXform.MapID),
|
new MapCoordinates(TransformSystem.GetWorldPosition(targetXform), targetXform.MapID)
|
||||||
TransformSystem
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var angle = targetXform.LocalRotation;
|
var angle = targetXform.LocalRotation;
|
||||||
|
|||||||
Reference in New Issue
Block a user