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:
@@ -52,7 +52,7 @@ namespace Content.Client.GameObjects.EntitySystems.AI
|
||||
continue;
|
||||
}
|
||||
|
||||
var (x, y) = _eyeManager.WorldToScreen(entity.Transform.GridPosition).Position;
|
||||
var (x, y) = _eyeManager.CoordinatesToScreen(entity.Transform.Coordinates).Position;
|
||||
var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f);
|
||||
panel.Visible = true;
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
/// <summary>
|
||||
/// Creates a construction ghost at the given location.
|
||||
/// </summary>
|
||||
public void SpawnGhost(ConstructionPrototype prototype, GridCoordinates loc, Direction dir)
|
||||
public void SpawnGhost(ConstructionPrototype prototype, EntityCoordinates loc, Direction dir)
|
||||
{
|
||||
if (GhostPresent(loc))
|
||||
{
|
||||
@@ -174,11 +174,11 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
/// <summary>
|
||||
/// Checks if any construction ghosts are present at the given position
|
||||
/// </summary>
|
||||
private bool GhostPresent(GridCoordinates loc)
|
||||
private bool GhostPresent(EntityCoordinates loc)
|
||||
{
|
||||
foreach (KeyValuePair<int, ConstructionGhostComponent> ghost in _ghosts)
|
||||
foreach (var ghost in _ghosts)
|
||||
{
|
||||
if (ghost.Value.Owner.Transform.GridPosition.Equals(loc))
|
||||
if (ghost.Value.Owner.Transform.Coordinates.Equals(loc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
var ghost = _ghosts[ghostId];
|
||||
var transform = ghost.Owner.Transform;
|
||||
var msg = new TryStartStructureConstructionMessage(transform.GridPosition, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
||||
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
||||
RaiseNetworkEvent(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
}
|
||||
|
||||
// Set position ready for 2nd+ frames.
|
||||
_playerPosition = _eyeManager.WorldToScreen(AttachedEntity.Transform.GridPosition);
|
||||
_playerPosition = _eyeManager.CoordinatesToScreen(AttachedEntity.Transform.Coordinates);
|
||||
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
|
||||
|
||||
if (_firstDraw)
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
return;
|
||||
}
|
||||
|
||||
var userGrid = _player.Transform.GridPosition;
|
||||
var userGrid = _player.Transform.Coordinates;
|
||||
|
||||
// Check cancellations / finishes
|
||||
foreach (var (id, doAfter) in doAfters)
|
||||
@@ -133,7 +133,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
||||
{
|
||||
var targetEntity = _entityManager.GetEntity(doAfter.TargetUid);
|
||||
|
||||
if (targetEntity.Transform.GridPosition != doAfter.TargetGrid)
|
||||
if (targetEntity.Transform.Coordinates != doAfter.TargetGrid)
|
||||
{
|
||||
doAfterComponent.Cancel(id, currentTime);
|
||||
continue;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
base.Shutdown();
|
||||
}
|
||||
|
||||
private bool HandleExamine(ICommonSession session, GridCoordinates coords, EntityUid uid)
|
||||
private bool HandleExamine(ICommonSession session, EntityCoordinates coords, EntityUid uid)
|
||||
{
|
||||
if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined))
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
|
||||
lunge.SetData(msg.Angle);
|
||||
|
||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.GridPosition);
|
||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates);
|
||||
entity.Transform.LocalRotation = msg.Angle;
|
||||
|
||||
var weaponArcAnimation = entity.GetComponent<MeleeWeaponArcAnimationComponent>();
|
||||
@@ -68,7 +68,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
|
||||
RsiState = sourceSprite.LayerGetState(0).Name,
|
||||
Coordinates = attacker.Transform.GridPosition,
|
||||
Coordinates = attacker.Transform.Coordinates,
|
||||
Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f),
|
||||
ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f),
|
||||
Velocity = msg.Angle.ToVec(),
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Content.Client.State;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.GameObjects.EntitySystemMessages;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Verbs;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Physics;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects.EntitySystems;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Client.Interfaces.Graphics.ClientEye;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Client.Interfaces.State;
|
||||
@@ -27,12 +23,9 @@ using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
@@ -53,7 +46,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
private EntityList _currentEntityList;
|
||||
private VerbPopup _currentVerbListRoot;
|
||||
@@ -67,7 +59,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
|
||||
SubscribeNetworkEvent<VerbSystemMessages.VerbsResponseMessage>(FillEntityPopup);
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
@@ -118,10 +110,10 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var mapCoordinates = args.Coordinates.ToMap(_mapManager);
|
||||
|
||||
var mapCoordinates = args.Coordinates.ToMap(_entityManager);
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
|
||||
|
||||
if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities))
|
||||
{
|
||||
return false;
|
||||
@@ -469,7 +461,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
|
||||
|
||||
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
|
||||
_entity.Transform.GridPosition,
|
||||
_entity.Transform.Coordinates,
|
||||
args.PointerLocation, _entity.Uid);
|
||||
|
||||
// client side command handlers will always be sent the local player session.
|
||||
|
||||
Reference in New Issue
Block a user