2022-06-23 00:52:28 -04:00
|
|
|
using Content.Shared.Actions.ActionTypes;
|
2019-08-14 10:49:28 +02:00
|
|
|
using Content.Shared.VendingMachines;
|
2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2022-04-17 03:16:02 -04:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
2019-08-14 10:49:28 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.VendingMachines
|
2019-08-14 10:49:28 +02:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2022-07-26 12:35:36 +12:00
|
|
|
[ComponentReference(typeof(SharedVendingMachineComponent))]
|
2022-08-31 14:12:09 +02:00
|
|
|
[Access(typeof(VendingMachineSystem))]
|
2022-05-05 19:35:06 -07:00
|
|
|
public sealed class VendingMachineComponent : SharedVendingMachineComponent
|
2019-08-14 10:49:28 +02:00
|
|
|
{
|
2022-01-30 22:16:41 -06:00
|
|
|
public bool Ejecting;
|
2022-08-31 14:12:09 +02:00
|
|
|
public bool Denying;
|
|
|
|
|
public bool DispenseOnHitCoolingDown;
|
|
|
|
|
|
|
|
|
|
public string? NextItemToEject;
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-01-30 22:16:41 -06:00
|
|
|
public bool Broken;
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-01-30 22:16:41 -06:00
|
|
|
/// <summary>
|
|
|
|
|
/// When true, will forcefully throw any object it dispenses
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("speedLimiter")]
|
|
|
|
|
public bool CanShoot = false;
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
public bool ThrowNextItem = false;
|
|
|
|
|
|
2022-06-23 00:52:28 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// The chance that a vending machine will randomly dispense an item on hit.
|
|
|
|
|
/// Chance is 0 if null.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("dispenseOnHitChance")]
|
|
|
|
|
public float? DispenseOnHitChance;
|
|
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// The minimum amount of damage that must be done per hit to have a chance
|
|
|
|
|
/// of dispensing an item.
|
|
|
|
|
/// </summary>
|
2022-06-23 00:52:28 -04:00
|
|
|
[DataField("dispenseOnHitThreshold")]
|
|
|
|
|
public float? DispenseOnHitThreshold;
|
|
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Amount of time in seconds that need to pass before damage can cause a vending machine to eject again.
|
|
|
|
|
/// This value is separate to <see cref="SharedVendingMachineComponent.EjectDelay"/> 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.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("dispenseOnHitCooldown")]
|
|
|
|
|
public float? DispenseOnHitCooldown = 1.0f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sound that plays when ejecting an item
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("soundVend")]
|
|
|
|
|
// Grabbed from: https://github.com/discordia-space/CEV-Eris/blob/f702afa271136d093ddeb415423240a2ceb212f0/sound/machines/vending_drop.ogg
|
2022-01-30 22:16:41 -06:00
|
|
|
public SoundSpecifier SoundVend = new SoundPathSpecifier("/Audio/Machines/machine_vend.ogg");
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Sound that plays when an item can't be ejected
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("soundDeny")]
|
|
|
|
|
// Yoinked from: https://github.com/discordia-space/CEV-Eris/blob/35bbad6764b14e15c03a816e3e89aa1751660ba9/sound/machines/Custom_deny.ogg
|
2022-01-30 22:16:41 -06:00
|
|
|
public SoundSpecifier SoundDeny = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// The action available to the player controlling the vending machine
|
|
|
|
|
/// </summary>
|
2022-06-23 00:52:28 -04:00
|
|
|
[DataField("action", customTypeSerializer: typeof(PrototypeIdSerializer<InstantActionPrototype>))]
|
|
|
|
|
public string? Action = "VendingThrow";
|
|
|
|
|
|
2022-01-30 22:16:41 -06:00
|
|
|
public float NonLimitedEjectForce = 7.5f;
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-01-30 22:16:41 -06:00
|
|
|
public float NonLimitedEjectRange = 5f;
|
2022-08-31 14:12:09 +02:00
|
|
|
|
|
|
|
|
public float EjectAccumulator = 0f;
|
|
|
|
|
public float DenyAccumulator = 0f;
|
|
|
|
|
public float DispenseOnHitAccumulator = 0f;
|
2019-08-14 10:49:28 +02:00
|
|
|
}
|
|
|
|
|
}
|