using Content.Shared.Actions.ActionTypes;
using Content.Shared.VendingMachines;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.VendingMachines
{
[RegisterComponent]
[ComponentReference(typeof(SharedVendingMachineComponent))]
[Access(typeof(VendingMachineSystem))]
public sealed class VendingMachineComponent : SharedVendingMachineComponent
{
public bool Ejecting;
public bool Denying;
public bool DispenseOnHitCoolingDown;
public string? NextItemToEject;
public bool Broken;
///
/// When true, will forcefully throw any object it dispenses
///
[DataField("speedLimiter")]
public bool CanShoot = false;
public bool ThrowNextItem = false;
///
/// The chance that a vending machine will randomly dispense an item on hit.
/// Chance is 0 if null.
///
[DataField("dispenseOnHitChance")]
public float? DispenseOnHitChance;
///
/// The minimum amount of damage that must be done per hit to have a chance
/// of dispensing an item.
///
[DataField("dispenseOnHitThreshold")]
public float? DispenseOnHitThreshold;
///
/// Amount of time in seconds that need to pass before damage can cause a vending machine to eject again.
/// This value is separate to because that value might be
/// 0 for a vending machine for legitimate reasons (no desired delay/no eject animation)
/// and can be circumvented with forced ejections.
///
[DataField("dispenseOnHitCooldown")]
public float? DispenseOnHitCooldown = 1.0f;
///
/// Sound that plays when ejecting an item
///
[DataField("soundVend")]
// Grabbed from: https://github.com/discordia-space/CEV-Eris/blob/f702afa271136d093ddeb415423240a2ceb212f0/sound/machines/vending_drop.ogg
public SoundSpecifier SoundVend = new SoundPathSpecifier("/Audio/Machines/machine_vend.ogg");
///
/// Sound that plays when an item can't be ejected
///
[DataField("soundDeny")]
// Yoinked from: https://github.com/discordia-space/CEV-Eris/blob/35bbad6764b14e15c03a816e3e89aa1751660ba9/sound/machines/Custom_deny.ogg
public SoundSpecifier SoundDeny = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
///
/// The action available to the player controlling the vending machine
///
[DataField("action", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string? Action = "VendingThrow";
public float NonLimitedEjectForce = 7.5f;
public float NonLimitedEjectRange = 5f;
public float EjectAccumulator = 0f;
public float DenyAccumulator = 0f;
public float DispenseOnHitAccumulator = 0f;
}
}