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:
@@ -83,7 +83,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var entity in _entityManager.GetEntitiesInRange(Owner.Transform.GridPosition, _range))
|
||||
foreach (var entity in _entityManager.GetEntitiesInRange(Owner.Transform.Coordinates, _range))
|
||||
{
|
||||
Flash(entity, eventArgs.User, _aoeFlashDuration);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
});
|
||||
}
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Weapons/flash.ogg", Owner.Transform.GridPosition,
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Weapons/flash.ogg", Owner.Transform.Coordinates,
|
||||
AudioParams.Default);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,7 +8,6 @@ using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -17,15 +16,12 @@ using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class MeleeWeaponComponent : Component, IAttack
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
@@ -90,8 +86,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
if(curTime < _cooldownEnd)
|
||||
return true;
|
||||
|
||||
var location = eventArgs.User.Transform.GridPosition;
|
||||
var angle = new Angle(eventArgs.ClickLocation.ToMapPos(_mapManager) - location.ToMapPos(_mapManager));
|
||||
var location = eventArgs.User.Transform.Coordinates;
|
||||
var angle = new Angle(eventArgs.ClickLocation.ToMapPos(Owner.EntityManager) - location.ToMapPos(Owner.EntityManager));
|
||||
|
||||
// This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes.
|
||||
var entities = ArcRayCast(eventArgs.User.Transform.WorldPosition, angle, eventArgs.User);
|
||||
@@ -150,8 +146,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
var target = eventArgs.TargetEntity;
|
||||
|
||||
var location = eventArgs.User.Transform.GridPosition;
|
||||
var angle = new Angle(eventArgs.ClickLocation.ToMapPos(_mapManager) - location.ToMapPos(_mapManager));
|
||||
var location = eventArgs.User.Transform.Coordinates;
|
||||
var angle = new Angle(eventArgs.ClickLocation.ToMapPos(Owner.EntityManager) - location.ToMapPos(Owner.EntityManager));
|
||||
|
||||
var audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
if (target != null)
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
if (!Cell.TryUseCharge(EnergyPerUse))
|
||||
return true;
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Weapons/egloves.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Weapons/egloves.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
@@ -112,7 +112,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
if (!(Cell.CurrentCharge < EnergyPerUse)) return true;
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
TurnOff();
|
||||
|
||||
return true;
|
||||
@@ -142,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
var sprite = Owner.GetComponent<SpriteComponent>();
|
||||
var item = Owner.GetComponent<ItemComponent>();
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
item.EquippedPrefix = "off";
|
||||
sprite.LayerSetState(0, "stunbaton_off");
|
||||
@@ -162,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
if (cell == null)
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
Owner.PopupMessage(user, Loc.GetString("Cell missing..."));
|
||||
return;
|
||||
@@ -170,12 +170,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
if (cell.CurrentCharge < EnergyPerUse)
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
Owner.PopupMessage(user, Loc.GetString("Dead cell..."));
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
item.EquippedPrefix = "on";
|
||||
sprite.LayerSetState(0, "stunbaton_on");
|
||||
@@ -230,10 +230,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
if (!hands.PutInHand(cell.Owner.GetComponent<ItemComponent>()))
|
||||
{
|
||||
cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
|
||||
cell.Owner.Transform.Coordinates = user.Transform.Coordinates;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Items/pistol_magout.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Items/pistol_magout.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
@@ -251,7 +251,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
return;
|
||||
}
|
||||
|
||||
var cell = Owner.EntityManager.SpawnEntity("PowerCellSmallHyper", Owner.Transform.GridPosition);
|
||||
var cell = Owner.EntityManager.SpawnEntity("PowerCellSmallHyper", Owner.Transform.Coordinates);
|
||||
_cellContainer.Insert(cell);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user