using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.VendingMachines.Components; [RegisterComponent, NetworkedComponent] [AutoGenerateComponentState(raiseAfterAutoHandleState: true)] [AutoGenerateComponentPause] [Access(typeof(SharedVendingMachineSystem))] public sealed partial class VendingMachineEjectComponent : Component { /// /// Used by the server to determine how long the vending machine stays in the "Deny" state. /// Used by the client to determine how long the deny animation should be played. /// [DataField] public TimeSpan DenyDelay = TimeSpan.FromSeconds(2); [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField] public TimeSpan? DenyEnd; /// /// Used by the server to determine how long the vending machine stays in the "Eject" state. /// The selected item is dispensed after this delay. /// Used by the client to determine how long the eject animation should be played. /// [DataField] public TimeSpan EjectDelay = TimeSpan.FromSeconds(1.2); [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField] public TimeSpan? EjectEnd; [ViewVariables] public bool Ejecting => EjectEnd != null; [ViewVariables] public bool Denying => DenyEnd != null; public EntProtoId? NextItemToEject; public bool ThrowNextItem; /// /// While disabled by EMP it randomly ejects items. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] public TimeSpan NextEmpEject = TimeSpan.Zero; /// /// Sound that plays when ejecting an item. /// [DataField] public SoundSpecifier SoundVend = new SoundPathSpecifier("/Audio/Machines/machine_vend.ogg") { Params = new AudioParams { Volume = -4f, Variation = 0.15f } }; /// /// Sound that plays when an item can't be ejected. /// [DataField] public SoundSpecifier SoundDeny = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg"); /// /// How much force to apply when the vending machine throws an item instead of dispensing it normally. /// [DataField] public float NonLimitedEjectForce = 7.5f; /// /// The maximum absolute X and Y values used to pick a random direction for thrown items. /// [DataField] public float NonLimitedEjectRange = 5f; }