mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 14:52:35 +02:00
Replace every usage of GridCoordinates with EntityCoordinates (#1280)
* Added struct skeleton for EntityCoordinates. * Polish EntityCoordinates, add tests, add EntityCoordinates to Transforms * Doc cleanup * Remove useless code * Return offset 0 when you don't have a parent * Test for making sure EntityCoordinates for entities without parents have offset 0 * Use parent transform's GridId for GetGridId. * Adds various methods, checks and tests * Replace GridCoordinates with EntityCoordinates * EyeManager.WorldToScreen fix * Address reviews * Fix za buildo * Fix one transform test * Fix the remaining tests * Remove duplicate * Remove another merge duplicate * Fix property * Rename most usages of GridCoordinates to EntityCoordinates. * Add WithEntityId method to EntityCoordinates. * Fix EntityCoordinates usage in GetEntitiesInRange * Remove cursed IMapGrid method, change naming. * Makes GridTileLookupSystem use EntityCoordinates Co-authored-by: Acruid <shatter66@gmail.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
This commit is contained in:
co-authored by
Acruid
Víctor Aguilera Puerto
parent
ec2fa6e86e
commit
0a67cecfa5
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Client.Interfaces.Graphics.ClientEye;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -20,11 +19,8 @@ namespace Robust.Client.Graphics.ClientEye
|
||||
/// </summary>
|
||||
public const int PixelsPerMeter = 32;
|
||||
|
||||
#pragma warning disable 649, CS8618
|
||||
// ReSharper disable twice NotNullMemberIsNotInitialized
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IClyde _displayManager;
|
||||
#pragma warning restore 649, CS8618
|
||||
[Dependency] private readonly IClyde _displayManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
// We default to this when we get set to a null eye.
|
||||
private readonly FixedEye _defaultEye = new FixedEye();
|
||||
@@ -102,10 +98,9 @@ namespace Robust.Client.Graphics.ClientEye
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ScreenCoordinates WorldToScreen(GridCoordinates point)
|
||||
public ScreenCoordinates CoordinatesToScreen(EntityCoordinates point)
|
||||
{
|
||||
var worldCoords = _mapManager.GetGrid(point.GridID).LocalToWorld(point);
|
||||
return new ScreenCoordinates(WorldToScreen(worldCoords.Position));
|
||||
return MapToScreen(point.ToMap(_entityManager));
|
||||
}
|
||||
|
||||
public ScreenCoordinates MapToScreen(MapCoordinates point)
|
||||
|
||||
Reference in New Issue
Block a user