2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.UserInterface;
|
2022-06-23 00:52:28 -04:00
|
|
|
using Content.Shared.Actions.ActionTypes;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2019-08-14 10:49:28 +02:00
|
|
|
using Content.Shared.VendingMachines;
|
2019-11-13 17:37:46 -05:00
|
|
|
using Robust.Server.GameObjects;
|
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-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-05-09 19:22:58 -07:00
|
|
|
|
2022-01-30 22:16:41 -06:00
|
|
|
public TimeSpan AnimationDuration = TimeSpan.Zero;
|
2022-05-09 19:22:58 -07:00
|
|
|
|
|
|
|
|
[ViewVariables] [DataField("pack", customTypeSerializer:typeof(PrototypeIdSerializer<VendingMachineInventoryPrototype>))]
|
|
|
|
|
public string PackPrototypeId = string.Empty;
|
|
|
|
|
|
2022-01-30 22:16:41 -06:00
|
|
|
public string SpriteName = "";
|
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-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;
|
|
|
|
|
|
|
|
|
|
[DataField("dispenseOnHitThreshold")]
|
|
|
|
|
public float? DispenseOnHitThreshold;
|
|
|
|
|
|
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
|
|
|
|
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-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
|
|
|
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(VendingMachineUiKey.Key);
|
2022-05-09 19:22:58 -07:00
|
|
|
|
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;
|
2019-08-14 10:49:28 +02:00
|
|
|
}
|
|
|
|
|
}
|