using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.CardboardBox.Components; /// /// Allows a user to control an EntityStorage entity while inside of it. /// Used for big cardboard box entities. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class CardboardBoxComponent : Component { /// /// The entity used for the box opening effect /// [DataField] public EntProtoId Effect = "Exclamation"; /// /// Sound played upon effect creation /// [DataField] public SoundSpecifier? EffectSound; /// /// Whether to prevent the box from making the sound and effect /// [DataField] public bool Quiet; /// /// How far should the box opening effect go? /// [DataField] public float Distance = 6f; /// /// Time at which the sound effect can next be played. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField] public TimeSpan EffectCooldown; /// /// Time between sound effects. Prevents effect spam /// [DataField] public TimeSpan CooldownDuration = TimeSpan.FromSeconds(5f); } /// /// Message to play the box effect. /// [Serializable, NetSerializable] public sealed class PlayBoxEffectMessage(NetEntity source, NetEntity mover) : EntityEventArgs { public NetEntity Source = source; public NetEntity Mover = mover; }