using Content.Server.Power.EntitySystems;
using Content.Shared.Power;
using Content.Shared.Tools;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using System.Diagnostics.Tracing;
using Content.Shared.Tools.Systems;
namespace Content.Server.Power.Components;
///
/// Allows the attached entity to be destroyed by a cutting tool, dropping a piece of cable.
///
[RegisterComponent]
[Access(typeof(CableSystem))]
public sealed partial class CableComponent : Component
{
[DataField]
public EntProtoId CableDroppedOnCutPrototype = "CableHVStack1";
///
/// The tool quality needed to cut the cable. Setting to null prevents cutting.
///
[DataField]
public ProtoId? CuttingQuality = SharedToolSystem.CutQuality;
///
/// Checked by to determine if there is
/// already a cable of a type on a tile.
///
[DataField("cableType")]
public CableType CableType = CableType.HighVoltage;
[DataField("cuttingDelay")]
public float CuttingDelay = 1f;
}
///
/// Event to be raised when a cable is anchored / unanchored
///
[ByRefEvent]
public readonly struct CableAnchorStateChangedEvent
{
public readonly TransformComponent Transform;
public EntityUid Entity => Transform.Owner;
public bool Anchored => Transform.Anchored;
///
/// If true, the entity is being detached to null-space
///
public readonly bool Detaching;
public CableAnchorStateChangedEvent(TransformComponent transform, bool detaching = false)
{
Detaching = detaching;
Transform = transform;
}
}