using Content.Server.Power.EntitySystems;
using Content.Shared.Power;
using Content.Shared.Tools;
using Content.Shared.Tools.Systems;
using Robust.Shared.Prototypes;
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]
public CableType CableType = CableType.HighVoltage;
[DataField]
public float CuttingDelay = 1f;
}
///
/// Event to be raised when a cable is anchored / unanchored
///
[ByRefEvent]
public readonly struct CableAnchorStateChangedEvent
{
public readonly Entity Cable;
public bool Anchored => Cable.Comp.Anchored;
///
/// If true, the entity is being detached to null-space
///
public readonly bool Detaching;
public CableAnchorStateChangedEvent(Entity cable, bool detaching = false)
{
Cable = cable;
Detaching = detaching;
}
}