mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* better * VendingMachineComponent upd * move components * small fix * move some fields to VendingMachineEjectComponent * move some fields to VendingMachineVisualsComponent * fix * move some fields to VendingMachineDispenseOnHitComponent * move NextEmpEject to VendingMachineEjectComponent * upd * split shared system to eject * no more dummies for name * fix contraband inventory * small fix * and again * move VendingMachineDispenseOnHitComponent to server * upd dispense * upd * move visuals to client * fix * move canshoot to server * fix client * fix * upd * fix merge * fix * upd1 * afterhandlestate * upd * more docs and protoid * upd visuals * upd components * reorganize * Entity<> * revert AfterAutoHandleState
81 lines
2.7 KiB
C#
81 lines
2.7 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan DenyDelay = TimeSpan.FromSeconds(2);
|
|
|
|
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField]
|
|
public TimeSpan? DenyEnd;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
[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;
|
|
|
|
/// <summary>
|
|
/// While disabled by EMP it randomly ejects items.
|
|
/// </summary>
|
|
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
|
|
public TimeSpan NextEmpEject = TimeSpan.Zero;
|
|
|
|
/// <summary>
|
|
/// Sound that plays when ejecting an item.
|
|
/// </summary>
|
|
[DataField]
|
|
public SoundSpecifier SoundVend = new SoundPathSpecifier("/Audio/Machines/machine_vend.ogg")
|
|
{
|
|
Params = new AudioParams
|
|
{
|
|
Volume = -4f,
|
|
Variation = 0.15f
|
|
}
|
|
};
|
|
|
|
/// <summary>
|
|
/// Sound that plays when an item can't be ejected.
|
|
/// </summary>
|
|
[DataField]
|
|
public SoundSpecifier SoundDeny = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
|
|
|
|
/// <summary>
|
|
/// How much force to apply when the vending machine throws an item instead of dispensing it normally.
|
|
/// </summary>
|
|
[DataField]
|
|
public float NonLimitedEjectForce = 7.5f;
|
|
|
|
/// <summary>
|
|
/// The maximum absolute X and Y values used to pick a random direction for thrown items.
|
|
/// </summary>
|
|
[DataField]
|
|
public float NonLimitedEjectRange = 5f;
|
|
}
|