using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Prying.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class PryingComponent : Component
{
///
/// Whether the entity can pry open powered doors
///
[DataField, AutoNetworkedField]
public bool PryPowered;
///
/// Whether the tool can bypass certain restrictions when prying.
/// For example door bolts.
///
[DataField]
public bool Force;
///
/// Modifier on the prying time.
/// Lower values result in more time.
///
[DataField, AutoNetworkedField]
public float SpeedModifier = 1.0f;
///
/// What sound to play when prying is finished.
///
[DataField]
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/crowbar.ogg");
///
/// Whether the entity can currently pry things.
///
[DataField]
public bool Enabled = true;
}
///
/// Raised directed on an entity before prying it.
/// Cancel to stop the entity from being pried open.
///
[ByRefEvent]
public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force, bool StrongPry)
{
public readonly EntityUid User = User;
///
/// Whether prying should be allowed even if whatever is being pried is powered.
///
public readonly bool PryPowered = PryPowered;
///
/// Whether prying should be allowed to go through under most circumstances. (E.g. airlock is bolted).
/// Systems may still wish to ignore this occasionally.
///
public readonly bool Force = Force;
///
/// Whether anything other than bare hands were used. This should only be false if prying is being performed without a prying comp.
///
public readonly bool StrongPry = StrongPry;
public string? Message;
public bool Cancelled;
}
///
/// Raised directed on an entity that has been pried.
///
[ByRefEvent]
public readonly record struct PriedEvent(EntityUid User)
{
public readonly EntityUid User = User;
}
///
/// Raised to determine how long the door's pry time should be modified by.
/// Multiply PryTimeModifier by the desired amount.
///
[ByRefEvent]
public record struct GetPryTimeModifierEvent
{
public readonly EntityUid User;
public float PryTimeModifier = 1.0f;
public float BaseTime = 5.0f;
public GetPryTimeModifierEvent(EntityUid user)
{
User = user;
}
}