Replace every usage of GridCoordinates with EntityCoordinates (#2021)

* Update RobustToolbox

* Transition direct type usages

* More updates

* Fix invalid use of to map

* Update RobustToolbox

* Fix dropping items

* Rename name usages of "GridCoordinates" to "EntityCoordinates"

* Revert "Update RobustToolbox"

This reverts commit 9f334a17c5908ded0043a63158bb671e4aa3f346.

* Revert "Update RobustToolbox"

This reverts commit 3a9c8cfa3606fa501aa84407796d2ad920853a09.

# Conflicts:
#	RobustToolbox

* Fix cursed IMapGrid method usage.

* GridTileLookupTest now uses EntityCoordinates

Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
This commit is contained in:
DrSmugleaf
2020-09-06 16:11:53 +02:00
committed by GitHub
parent 72d2318ea7
commit 48b61f6bcc
196 changed files with 780 additions and 676 deletions

View File

@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Fluids
{
var solutionComponent = component.Owner.GetComponent<SolutionComponent>();
// Need this as when we split the component's owner may be deleted
var entityLocation = component.Owner.Transform.GridPosition;
var entityLocation = component.Owner.Transform.Coordinates;
var solution = solutionComponent.SplitSolution(solutionComponent.CurrentVolume);
solution.SpillAt(entityLocation, "PuddleSmear");
}

View File

@@ -195,7 +195,7 @@ namespace Content.Server.GameObjects.Components.Fluids
return true;
}
EntitySystem.Get<AudioSystem>().PlayAtCoords(_spillSound, Owner.Transform.GridPosition);
EntitySystem.Get<AudioSystem>().PlayAtCoords(_spillSound, Owner.Transform.Coordinates);
return true;
}
@@ -354,7 +354,7 @@ namespace Content.Server.GameObjects.Components.Fluids
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
if (!Owner.Transform.GridPosition.Offset(direction).TryGetTileRef(out var tile))
if (!Owner.Transform.Coordinates.Offset(direction).TryGetTileRef(out var tile))
{
return false;
}

View File

@@ -23,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Fluids
/// <returns>The puddle if one was created, null otherwise.</returns>
public static PuddleComponent? SpillAt(this Solution solution, IEntity entity, string prototype, bool sound = true)
{
var coordinates = entity.Transform.GridPosition;
var coordinates = entity.Transform.Coordinates;
return solution.SpillAt(coordinates, prototype, sound);
}
@@ -52,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Fluids
/// <param name="prototype">The prototype to use.</param>
/// <param name="sound">Whether or not to play the spill sound.</param>
/// <returns>The puddle if one was created, null otherwise.</returns>
public static PuddleComponent? SpillAt(this Solution solution, GridCoordinates coordinates, string prototype, bool sound = true)
public static PuddleComponent? SpillAt(this Solution solution, EntityCoordinates coordinates, string prototype, bool sound = true)
{
if (solution.TotalVolume == 0)
{
@@ -63,7 +63,8 @@ namespace Content.Server.GameObjects.Components.Fluids
var entityManager = IoCManager.Resolve<IEntityManager>();
var serverEntityManager = IoCManager.Resolve<IServerEntityManager>();
var mapGrid = mapManager.GetGrid(coordinates.GridID);
var gridId = coordinates.GetGridId(entityManager);
var mapGrid = mapManager.GetGrid(gridId);
// If space return early, let that spill go out into the void
var tileRef = mapGrid.GetTileRef(coordinates);
@@ -74,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Fluids
// Get normalized co-ordinate for spill location and spill it in the centre
// TODO: Does SnapGrid or something else already do this?
var spillTileMapGrid = mapManager.GetGrid(coordinates.GridID);
var spillTileMapGrid = mapManager.GetGrid(gridId);
var spillTileRef = spillTileMapGrid.GetTileRef(coordinates).GridIndices;
var spillGridCoords = spillTileMapGrid.GridTileToLocal(spillTileRef);
@@ -119,7 +120,7 @@ namespace Content.Server.GameObjects.Components.Fluids
/// <param name="puddle">The puddle if one was created, null otherwise.</param>
/// <param name="sound">Play the spill sound.</param>
/// <returns>True if a puddle was created, false otherwise.</returns>
public static bool TrySpillAt(this Solution solution, GridCoordinates coordinates, string prototype, [NotNullWhen(true)] out PuddleComponent? puddle, bool sound = true)
public static bool TrySpillAt(this Solution solution, EntityCoordinates coordinates, string prototype, [NotNullWhen(true)] out PuddleComponent? puddle, bool sound = true)
{
puddle = solution.SpillAt(coordinates, prototype, sound);
return puddle != null;

View File

@@ -74,8 +74,8 @@ namespace Content.Server.GameObjects.Components.Fluids
return;
}
var playerPos = eventArgs.User.Transform.GridPosition;
if (eventArgs.ClickLocation.GridID != playerPos.GridID)
var playerPos = eventArgs.User.Transform.Coordinates;
if (eventArgs.ClickLocation.GetGridId(_serverEntityManager) != playerPos.GetGridId(_serverEntityManager))
return;
if (!Owner.TryGetComponent(out SolutionComponent contents))