using Robust.Shared.Audio; using Robust.Shared.GameStates; 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] public sealed class CardboardBoxComponent : Component { /// /// The person in control of this box /// [ViewVariables] [DataField("mover")] public EntityUid? Mover; /// /// The entity used for the box opening effect /// [ViewVariables(VVAccess.ReadWrite)] [DataField("effect")] public string Effect = "Exclamation"; /// /// Sound played upon effect creation /// [ViewVariables(VVAccess.ReadWrite)] [DataField("effectSound")] public SoundSpecifier? EffectSound; /// /// How far should the box opening effect go? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("distance")] public float Distance = 6f; /// /// Current time + max effect cooldown to check to see if effect can play again /// Prevents effect spam /// [DataField("effectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan EffectCooldown = TimeSpan.FromSeconds(1f); /// /// How much time should pass + current time until the effect plays again /// Prevents effect spam /// [DataField("maxEffectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))] public static readonly TimeSpan MaxEffectCooldown = TimeSpan.FromSeconds(5f); } [Serializable, NetSerializable] public sealed class PlayBoxEffectMessage : EntityEventArgs { public EntityUid Source; public EntityUid Mover; public PlayBoxEffectMessage(EntityUid source, EntityUid mover) { Source = source; Mover = mover; } }