Cleanup warnings: Use TransformSystem for anchoring (#39778)
* Cleanup * Bonus * I hope this helps * Revert
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<DefaultWindow xmlns="https://spacestation14.io"
|
||||
Title="{Loc admin-camera-window-title-placeholder}"
|
||||
SetSize="425 550"
|
||||
MinSize="200 225"
|
||||
Name="Window">
|
||||
MinSize="200 225">
|
||||
</DefaultWindow>
|
||||
|
||||
@@ -35,7 +35,8 @@ public sealed class ImmovableRodRule : StationEventSystem<ImmovableRodRuleCompon
|
||||
var speed = RobustRandom.NextFloat(rod.MinSpeed, rod.MaxSpeed);
|
||||
var angle = RobustRandom.NextAngle();
|
||||
var direction = angle.ToVec();
|
||||
var spawnCoords = targetCoords.ToMap(EntityManager, _transform).Offset(-direction * speed * despawn.Lifetime / 2);
|
||||
var mapCoords = _transform.ToMapCoordinates(targetCoords);
|
||||
var spawnCoords = mapCoords.Offset(-direction * speed * despawn.Lifetime / 2);
|
||||
var ent = Spawn(protoName, spawnCoords);
|
||||
_gun.ShootProjectile(ent, direction, Vector2.Zero, uid, speed: speed);
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ namespace Content.Shared.Coordinates.Helpers
|
||||
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
||||
{
|
||||
IoCManager.Resolve(ref entMan, ref mapManager);
|
||||
var xformSys = entMan.System<SharedTransformSystem>();
|
||||
|
||||
var gridId = coordinates.GetGridUid(entMan);
|
||||
var gridId = xformSys.GetGrid(coordinates.EntityId);
|
||||
|
||||
if (gridId == null)
|
||||
{
|
||||
var xformSys = entMan.System<SharedTransformSystem>();
|
||||
var mapPos = xformSys.ToMapCoordinates(coordinates);
|
||||
var mapX = (int)Math.Floor(mapPos.X) + 0.5f;
|
||||
var mapY = (int)Math.Floor(mapPos.Y) + 0.5f;
|
||||
@@ -24,11 +24,11 @@ namespace Content.Shared.Coordinates.Helpers
|
||||
|
||||
var grid = entMan.GetComponent<MapGridComponent>(gridId.Value);
|
||||
var tileSize = grid.TileSize;
|
||||
var localPos = coordinates.WithEntityId(gridId.Value).Position;
|
||||
var localPos = xformSys.WithEntityId(coordinates, gridId.Value).Position;
|
||||
var x = (int)Math.Floor(localPos.X / tileSize) + tileSize / 2f;
|
||||
var y = (int)Math.Floor(localPos.Y / tileSize) + tileSize / 2f;
|
||||
var gridPos = new EntityCoordinates(gridId.Value, new Vector2(x, y));
|
||||
return gridPos.WithEntityId(coordinates.EntityId);
|
||||
return xformSys.WithEntityId(gridPos, coordinates.EntityId);
|
||||
}
|
||||
|
||||
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, MapGridComponent grid)
|
||||
|
||||
Reference in New Issue
Block a user