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:
@@ -89,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
|
||||
if (_unspawnedCount > 0)
|
||||
{
|
||||
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.GridPosition);
|
||||
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||
_unspawnedCount--;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -26,6 +27,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
public class AmmoComponent : Component, IExamine
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override string Name => "Ammo";
|
||||
public BallisticCaliber Caliber => _caliber;
|
||||
@@ -106,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
}
|
||||
}
|
||||
|
||||
public IEntity TakeBullet(GridCoordinates spawnAtGrid, MapCoordinates spawnAtMap)
|
||||
public IEntity TakeBullet(EntityCoordinates spawnAtGrid, MapCoordinates spawnAtMap)
|
||||
{
|
||||
if (_ammoIsProjectile)
|
||||
{
|
||||
@@ -124,7 +126,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
appearanceComponent.SetData(AmmoVisuals.Spent, true);
|
||||
}
|
||||
|
||||
var entity = spawnAtGrid.GridID != GridId.Invalid ? Owner.EntityManager.SpawnEntity(_projectileId, spawnAtGrid) : Owner.EntityManager.SpawnEntity(_projectileId, spawnAtMap);
|
||||
var entity = spawnAtGrid.GetGridId(_entityManager) != GridId.Invalid
|
||||
? Owner.EntityManager.SpawnEntity(_projectileId, spawnAtGrid)
|
||||
: Owner.EntityManager.SpawnEntity(_projectileId, spawnAtMap);
|
||||
|
||||
DebugTools.AssertNotNull(entity);
|
||||
return entity;
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
else if (_unspawnedCount > 0)
|
||||
{
|
||||
_unspawnedCount--;
|
||||
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.GridPosition);
|
||||
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||
}
|
||||
|
||||
UpdateAppearance();
|
||||
@@ -160,7 +160,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
var itemComponent = ammo.GetComponent<ItemComponent>();
|
||||
if (!handsComponent.CanPutInHand(itemComponent))
|
||||
{
|
||||
ammo.Transform.GridPosition = eventArgs.User.Transform.GridPosition;
|
||||
ammo.Transform.Coordinates = eventArgs.User.Transform.Coordinates;
|
||||
ServerRangedBarrelComponent.EjectCasing(ammo);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
|
||||
if (_unspawnedCount > 0)
|
||||
{
|
||||
entity = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.GridPosition);
|
||||
entity = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||
_unspawnedCount--;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user