using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.SubFloor
{
///
/// Simple component that automatically hides the sibling
/// when the tile it's on is not a sub floor
/// (plating).
///
///
[NetworkedComponent]
[RegisterComponent]
[Friend(typeof(SubFloorHideSystem))]
public sealed class SubFloorHideComponent : Component
{
///
/// Whether the entity will be hid when not in subfloor.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("enabled")]
public bool Enabled { get; set; } = true;
///
/// Whether the entity's current position has a "Floor-type" tile above its current position.
///
public bool IsUnderCover { get; set; } = false;
/*
* An un-anchored hiding entity would require listening to on-move events in case it moves into a sub-floor
* tile. Also T-Ray scanner headaches.
///
/// This entity needs to be anchored to be hid when not in subfloor.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("requireAnchored")]
public bool RequireAnchored { get; set; } = true;
*/
public override ComponentState GetComponentState()
{
return new SubFloorHideComponentState(Enabled);
}
///
/// Whether or not this entity is supposed
/// to be visible.
///
[ViewVariables]
public bool Visible { get; set; }
///
/// The entities this subfloor is revealed by.
///
[ViewVariables]
public HashSet RevealedBy { get; set; } = new();
}
[Serializable, NetSerializable]
public sealed class SubFloorHideComponentState : ComponentState
{
public bool Enabled { get; }
public SubFloorHideComponentState(bool enabled)
{
Enabled = enabled;
}
}
}