2021-12-13 23:46:47 -08:00
|
|
|
using Robust.Shared.GameStates;
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.SubFloor;
|
|
|
|
|
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
[NetworkedComponent]
|
2022-02-14 16:20:35 +13:00
|
|
|
public sealed class TrayScannerComponent : Component
|
2021-12-13 23:46:47 -08:00
|
|
|
{
|
2022-02-14 16:20:35 +13:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the scanner is currently on.
|
|
|
|
|
/// </summary>
|
2021-12-13 23:46:47 -08:00
|
|
|
[ViewVariables]
|
2022-02-14 16:20:35 +13:00
|
|
|
public bool Enabled { get; set; }
|
2021-12-13 23:46:47 -08:00
|
|
|
|
2022-02-14 16:20:35 +13:00
|
|
|
/// <summary>
|
|
|
|
|
/// Last position of the scanner. Rounded to integers to avoid excessive entity lookups when moving.
|
|
|
|
|
/// </summary>
|
2021-12-13 23:46:47 -08:00
|
|
|
[ViewVariables]
|
2022-02-14 16:20:35 +13:00
|
|
|
public Vector2i? LastLocation { get; set; }
|
2021-12-13 23:46:47 -08:00
|
|
|
|
2022-02-14 16:20:35 +13:00
|
|
|
/// <summary>
|
|
|
|
|
/// Radius in which the scanner will reveal entities. Centered on the <see cref="LastLocation"/>.
|
|
|
|
|
/// </summary>
|
2021-12-13 23:46:47 -08:00
|
|
|
[DataField("range")]
|
2022-02-14 16:20:35 +13:00
|
|
|
public float Range { get; set; } = 2.5f;
|
2021-12-13 23:46:47 -08:00
|
|
|
|
2022-02-14 16:20:35 +13:00
|
|
|
/// <summary>
|
|
|
|
|
/// The sub-floor entities that this scanner is currently revealing.
|
|
|
|
|
/// </summary>
|
2021-12-13 23:46:47 -08:00
|
|
|
[ViewVariables]
|
|
|
|
|
public HashSet<EntityUid> RevealedSubfloors = new();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class TrayScannerState : ComponentState
|
|
|
|
|
{
|
2022-02-14 16:20:35 +13:00
|
|
|
public bool Enabled;
|
2021-12-13 23:46:47 -08:00
|
|
|
|
2022-02-14 16:20:35 +13:00
|
|
|
public TrayScannerState(bool enabled)
|
2021-12-13 23:46:47 -08:00
|
|
|
{
|
2022-02-14 16:20:35 +13:00
|
|
|
Enabled = enabled;
|
2021-12-13 23:46:47 -08:00
|
|
|
}
|
|
|
|
|
}
|