World target action uses entity coordinates (#12484)

This commit is contained in:
Rane
2022-12-06 18:03:20 -05:00
committed by GitHub
parent 2eb9926af8
commit 8d1773742e
5 changed files with 29 additions and 34 deletions

View File

@@ -39,7 +39,7 @@ public sealed class MagicSystem : EntitySystem
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly GunSystem _gunSystem = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
public override void Initialize()
{
base.Initialize();
@@ -159,7 +159,7 @@ public sealed class MagicSystem : EntitySystem
foreach (var pos in GetSpawnPositions(xform, ev.Pos))
{
var ent = Spawn(ev.Prototype, pos.SnapToGrid(EntityManager, _mapManager));
_gunSystem.ShootProjectile(ent,ev.Target.Position - Transform(ent).MapPosition.Position, ev.Performer);
_gunSystem.ShootProjectile(ent, ev.Target.Position - Transform(ent).Coordinates.Position, ev.Performer);
}
}
@@ -232,9 +232,9 @@ public sealed class MagicSystem : EntitySystem
var transform = Transform(args.Performer);
if (transform.MapID != args.Target.MapId) return;
if (transform.MapID != args.Target.GetMapId(EntityManager)) return;
transform.WorldPosition = args.Target.Position;
_transformSystem.SetCoordinates(args.Performer, args.Target);
transform.AttachToGridOrMap();
SoundSystem.Play(args.BlinkSound.GetSound(), Filter.Pvs(args.Target), args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume));
args.Handled = true;
@@ -323,14 +323,14 @@ public sealed class MagicSystem : EntitySystem
/// offset
/// </remarks>
/// <param name="entityEntries"> The list of Entities to spawn in</param>
/// <param name="mapCoords"> Map Coordinates where the entities will spawn</param>
/// <param name="entityCoords"> Map Coordinates where the entities will spawn</param>
/// <param name="lifetime"> Check to see if the entities should self delete</param>
/// <param name="offsetVector2"> A Vector2 offset that the entities will spawn in</param>
private void SpawnSpellHelper(List<EntitySpawnEntry> entityEntries, MapCoordinates mapCoords, float? lifetime, Vector2 offsetVector2)
private void SpawnSpellHelper(List<EntitySpawnEntry> entityEntries, EntityCoordinates entityCoords, float? lifetime, Vector2 offsetVector2)
{
var getProtos = EntitySpawnCollection.GetSpawns(entityEntries, _random);
var offsetCoords = mapCoords;
var offsetCoords = entityCoords;
foreach (var proto in getProtos)
{
// TODO: Share this code with instant because they're both doing similar things for positioning.