Clean up vending machines and port their visualizer (#10465)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.VendingMachines;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
@@ -9,9 +7,14 @@ 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;
|
||||
|
||||
@@ -21,6 +24,8 @@ namespace Content.Server.VendingMachines
|
||||
[DataField("speedLimiter")]
|
||||
public bool CanShoot = false;
|
||||
|
||||
public bool ThrowNextItem = false;
|
||||
|
||||
/// <summary>
|
||||
/// The chance that a vending machine will randomly dispense an item on hit.
|
||||
/// Chance is 0 if null.
|
||||
@@ -28,24 +33,48 @@ namespace Content.Server.VendingMachines
|
||||
[DataField("dispenseOnHitChance")]
|
||||
public float? DispenseOnHitChance;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum amount of damage that must be done per hit to have a chance
|
||||
/// of dispensing an item.
|
||||
/// </summary>
|
||||
[DataField("dispenseOnHitThreshold")]
|
||||
public float? DispenseOnHitThreshold;
|
||||
|
||||
/// <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>
|
||||
[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");
|
||||
|
||||
/// <summary>
|
||||
/// Sound that plays when an item can't be ejected
|
||||
/// </summary>
|
||||
[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");
|
||||
|
||||
/// <summary>
|
||||
/// The action available to the player controlling the vending machine
|
||||
/// </summary>
|
||||
[DataField("action", customTypeSerializer: typeof(PrototypeIdSerializer<InstantActionPrototype>))]
|
||||
public string? Action = "VendingThrow";
|
||||
|
||||
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(VendingMachineUiKey.Key);
|
||||
|
||||
public float NonLimitedEjectForce = 7.5f;
|
||||
|
||||
public float NonLimitedEjectRange = 5f;
|
||||
|
||||
public float EjectAccumulator = 0f;
|
||||
public float DenyAccumulator = 0f;
|
||||
public float DispenseOnHitAccumulator = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user