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.Shared.GameObjects.Components.Movement
/// </summary>
(Vector2 walking, Vector2 sprinting) VelocityDir { get; }
GridCoordinates LastPosition { get; set; }
EntityCoordinates LastPosition { get; set; }
float StepSoundDistance { get; set; }

View File

@@ -132,7 +132,7 @@ namespace Content.Shared.GameObjects.Components.Movement
}
}
public abstract GridCoordinates LastPosition { get; set; }
public abstract EntityCoordinates LastPosition { get; set; }
public abstract float StepSoundDistance { get; set; }
/// <summary>

View File

@@ -38,9 +38,9 @@ namespace Content.Shared.GameObjects.Components.Movement
[Serializable, NetSerializable]
public class TeleportMessage : ComponentMessage
{
public readonly GridCoordinates Target;
public readonly EntityCoordinates Target;
public TeleportMessage(GridCoordinates target)
public TeleportMessage(EntityCoordinates target)
{
Target = target;
}

View File

@@ -31,23 +31,23 @@ namespace Content.Shared.GameObjects.Components
{
// To see what these do look at DoAfter and DoAfterEventArgs
public byte ID { get; }
public TimeSpan StartTime { get; }
public GridCoordinates UserGrid { get; }
public GridCoordinates TargetGrid { get; }
public EntityCoordinates UserGrid { get; }
public EntityCoordinates TargetGrid { get; }
public EntityUid TargetUid { get; }
public float Delay { get; }
// TODO: The other ones need predicting
public bool BreakOnUserMove { get; }
public bool BreakOnTargetMove { get; }
public DoAfterMessage(byte id, GridCoordinates userGrid, GridCoordinates targetGrid, TimeSpan startTime, float delay, bool breakOnUserMove, bool breakOnTargetMove, EntityUid targetUid = default)
public DoAfterMessage(byte id, EntityCoordinates userGrid, EntityCoordinates targetGrid, TimeSpan startTime, float delay, bool breakOnUserMove, bool breakOnTargetMove, EntityUid targetUid = default)
{
ID = id;
UserGrid = userGrid;
@@ -59,4 +59,4 @@ namespace Content.Shared.GameObjects.Components
TargetUid = targetUid;
}
}
}
}

View File

@@ -11,11 +11,11 @@ namespace Content.Shared.GameObjects.EntitySystemMessages
[Serializable, NetSerializable]
public class DragDropMessage : EntitySystemMessage
{
public GridCoordinates DropLocation { get; }
public EntityCoordinates DropLocation { get; }
public EntityUid Dropped { get; }
public EntityUid Target { get; }
public DragDropMessage(GridCoordinates dropLocation, EntityUid dropped, EntityUid target)
public DragDropMessage(EntityCoordinates dropLocation, EntityUid dropped, EntityUid target)
{
DropLocation = dropLocation;
Dropped = dropped;

View File

@@ -47,7 +47,7 @@ namespace Content.Shared.GameObjects.EntitySystems
public class ExplosionEventArgs : EventArgs
{
public GridCoordinates Source { get; set; }
public EntityCoordinates Source { get; set; }
public IEntity Target { get; set; }
public ExplosionSeverity Severity { get; set; }
}
@@ -71,7 +71,7 @@ namespace Content.Shared.GameObjects.EntitySystems
owner.Delete();
}
public void HandleExplosion(GridCoordinates source, IEntity target, ExplosionSeverity severity)
public void HandleExplosion(EntityCoordinates source, IEntity target, ExplosionSeverity severity)
{
var eventArgs = new ExplosionEventArgs
{

View File

@@ -22,7 +22,7 @@ namespace Content.Shared.GameObjects.EntitySystems
/// <summary>
/// Position to start building.
/// </summary>
public readonly GridCoordinates Location;
public readonly EntityCoordinates Location;
/// <summary>
/// The construction prototype to start building.
@@ -36,7 +36,7 @@ namespace Content.Shared.GameObjects.EntitySystems
/// </summary>
public readonly int Ack;
public TryStartStructureConstructionMessage(GridCoordinates loc, string prototypeName, Angle angle, int ack)
public TryStartStructureConstructionMessage(EntityCoordinates loc, string prototypeName, Angle angle, int ack)
{
Location = loc;
PrototypeName = prototypeName;

View File

@@ -5,7 +5,6 @@ using Content.Shared.Physics;
using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Physics;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -21,7 +20,6 @@ namespace Content.Shared.GameObjects.EntitySystems
public class SharedInteractionSystem : EntitySystem
{
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public const float InteractionRange = 2;
public const float InteractionRangeSquared = InteractionRange * InteractionRange;
@@ -284,7 +282,7 @@ namespace Content.Shared.GameObjects.EntitySystems
/// </returns>
public bool InRangeUnobstructed(
IEntity origin,
GridCoordinates other,
EntityCoordinates other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null,
@@ -292,7 +290,7 @@ namespace Content.Shared.GameObjects.EntitySystems
bool popup = false)
{
var originPosition = origin.Transform.MapPosition;
var otherPosition = other.ToMap(_mapManager);
var otherPosition = other.ToMap(EntityManager);
predicate ??= e => e == origin;
var inRange = InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker);
@@ -522,7 +520,7 @@ namespace Content.Shared.GameObjects.EntitySystems
if (target == null)
{
otherPosition = args.ClickLocation.ToMap(_mapManager);
otherPosition = args.ClickLocation.ToMap(EntityManager);
}
else
{

View File

@@ -5,7 +5,6 @@ using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.Physics;
using Content.Shared.Physics.Pull;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Input;
@@ -58,7 +57,7 @@ namespace Content.Shared.GameObjects.EntitySystems
collidable.EnsureController<MoverController>();
var weightless = !transform.Owner.HasComponent<MovementIgnoreGravityComponent>() &&
_physicsManager.IsWeightless(transform.GridPosition);
_physicsManager.IsWeightless(transform.Coordinates);
if (weightless)
{