Files
tbd-station-14/Content.Shared/SubFloor/SubFloorHideComponent.cs
2022-07-09 02:59:39 -07:00

63 lines
2.6 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic;
namespace Content.Shared.SubFloor
{
/// <summary>
/// Simple component that automatically hides the sibling
/// <see cref="SpriteComponent" /> when the tile it's on is not a sub floor
/// (plating).
/// </summary>
/// <seealso cref="P:Content.Shared.Maps.ContentTileDefinition.IsSubFloor" />
[NetworkedComponent]
[RegisterComponent]
[Access(typeof(SharedSubFloorHideSystem))]
public sealed class SubFloorHideComponent : Component
{
/// <summary>
/// Whether the entity's current position has a "Floor-type" tile above its current position.
/// </summary>
[ViewVariables]
public bool IsUnderCover { get; set; } = false;
/// <summary>
/// Whether interactions with this entity should be blocked while it is under floor tiles.
/// </summary>
/// <remarks>
/// Useful for entities like vents, which are only partially hidden. Anchor attempts will still be blocked.
/// </remarks>
[DataField("blockInteractions")]
public bool BlockInteractions { get; set; } = true;
/// <summary>
/// Whether this entity's ambience should be disabled when underneath the floor.
/// </summary>
/// <remarks>
/// Useful for cables and piping, gives maint it's distinct noise.
/// </remarks>
[DataField("blockAmbience")]
public bool BlockAmbience { get; set; } = true;
/// <summary>
/// When revealed using some scanning tool, what transparency should be used to draw this item?
/// </summary>
[DataField("scannerTransparency")]
public float ScannerTransparency = 0.8f;
/// <summary>
/// Sprite layer keys for the layers that are always visible, even if the entity is below a floor tile. E.g.,
/// the vent part of a vent is always visible, even though the piping is hidden.
/// </summary>
[DataField("visibleLayers", customTypeSerializer:typeof(CustomHashSetSerializer<object, AppearanceKeySerializer>))]
public HashSet<object> VisibleLayers = new() { SubfloorLayers.FirstLayer };
/// <summary>
/// The entities this subfloor is revealed by.
/// </summary>
[ViewVariables]
[Access(typeof(SharedSubFloorHideSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
public HashSet<EntityUid> RevealedBy { get; set; } = new();
}
}