Ranged weapon firing does not depend on DefaultGrid anymore.

This commit is contained in:
Acruid
2020-08-11 16:44:15 -07:00
parent 32e4c24342
commit cdc6ec3bfc
5 changed files with 78 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Weapons.Ranged
@@ -26,14 +27,33 @@ namespace Content.Shared.GameObjects.Components.Weapons.Ranged
}
}
/// <summary>
/// A component message raised when the weapon is fired at a position on the map.
/// </summary>
[Serializable, NetSerializable]
public sealed class FirePosComponentMessage : ComponentMessage
{
public GridCoordinates Target { get; }
/// <summary>
/// If this is not invalid, the target position is relative to the grid.
/// Otherwise, it is a map position.
/// </summary>
public GridId TargetGrid { get; }
public FirePosComponentMessage(GridCoordinates target)
/// <summary>
/// If Target Grid is not invalid, this is relative to the grid, otherwise
/// it is a map position.
/// </summary>
public Vector2 TargetPosition { get; }
/// <summary>
/// Constructs a new instance of <see cref="FirePosComponentMessage"/>.
/// </summary>
/// <param name="targetGrid">The grid that the target position is on, if any.</param>
/// <param name="targetPosition">Target position relative to the grid, or a map position if the grid is invalid.</param>
public FirePosComponentMessage(GridId targetGrid, Vector2 targetPosition)
{
Target = target;
TargetGrid = targetGrid;
TargetPosition = targetPosition;
}
}
}