Makes weapons use GridCoordinates and default to MapCoordinates if grid is invalid

This commit is contained in:
Víctor Aguilera Puerto
2020-07-10 01:53:36 +02:00
parent e54e708cf2
commit 8785371563
7 changed files with 17 additions and 15 deletions

View File

@@ -104,7 +104,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
}
}
public IEntity TakeBullet(MapCoordinates spawnAt)
public IEntity TakeBullet(GridCoordinates spawnAtGrid, MapCoordinates spawnAtMap)
{
if (_ammoIsProjectile)
{
@@ -122,7 +122,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
appearanceComponent.SetData(AmmoVisuals.Spent, true);
}
var entity = Owner.EntityManager.SpawnEntity(_projectileId, spawnAt);
var entity = spawnAtGrid.GridID != GridId.Invalid ? Owner.EntityManager.SpawnEntity(_projectileId, spawnAtGrid) : Owner.EntityManager.SpawnEntity(_projectileId, spawnAtMap);
DebugTools.AssertNotNull(entity);
return entity;
}