using Content.Shared.Damage; using Content.Shared.Stacks; using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.Audio.Components; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Xenoarchaeology.Equipment; /// /// This is an entity storage that, when activated, crushes the artifact inside of it and gives artifact fragments. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] [Access(typeof(SharedArtifactCrusherSystem))] public sealed partial class ArtifactCrusherComponent : Component { /// /// Whether or not the crusher is currently in the process of crushing something. /// [DataField, AutoNetworkedField] public bool Crushing; /// /// When the current crushing will end. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public TimeSpan CrushEndTime; /// /// The next second. Used to apply damage over time. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public TimeSpan NextSecond; /// /// The total duration of the crushing. /// [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public TimeSpan CrushDuration = TimeSpan.FromSeconds(10); /// /// A whitelist specifying what items, when crushed, will give fragments. /// [DataField] public EntityWhitelist CrushingWhitelist = new(); /// /// The minimum amount of fragments spawned. /// [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public int MinFragments = 2; /// /// The maximum amount of fragments spawned, non-inclusive. /// [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public int MaxFragments = 5; /// /// The material for the fragments. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public ProtoId FragmentStackProtoId = "ArtifactFragment"; /// /// A container used to hold fragments and gibs from crushing. /// [ViewVariables] public Container OutputContainer; /// /// The ID for /// [DataField] public string OutputContainerName = "output_container"; /// /// Damage dealt each second to entities inside while crushing. /// [DataField] public DamageSpecifier CrushingDamage = new(); /// /// Sound played at the end of a successful crush. /// [DataField, AutoNetworkedField] public SoundSpecifier? CrushingCompleteSound = new SoundCollectionSpecifier("MetalCrunch"); /// /// Sound played throughout the entire crushing. Cut off if ended early. /// [DataField, AutoNetworkedField] public SoundSpecifier? CrushingSound = new SoundPathSpecifier("/Audio/Effects/hydraulic_press.ogg"); /// /// Stores entity of to allow ending it early. /// [DataField] public (EntityUid, AudioComponent)? CrushingSoundEntity; /// /// When enabled, stops the artifact crusher from being opened when it is being crushed. /// [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)] public bool AutoLock = false; } [Serializable, NetSerializable] public enum ArtifactCrusherVisuals : byte { Crushing }