Make vending machine restocks predicted (and its sound not spammable) (#38609)
* feat: make vending machine restocks predicted * refactor: VendingMachineRestockComponent cleanup * refactor: minor simplification * revert: refactor: minor simplification; load bearing IsFirstTimePredicted lol second guessed myself * chore: unneeded VendingMachineSystem dep * Update Content.Shared/VendingMachines/VendingMachineComponent.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -12,23 +12,20 @@ public sealed partial class VendingMachineRestockComponent : Component
|
||||
/// <summary>
|
||||
/// The time (in seconds) that it takes to restock a machine.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("restockDelay")]
|
||||
[DataField]
|
||||
public TimeSpan RestockDelay = TimeSpan.FromSeconds(5.0f);
|
||||
|
||||
/// <summary>
|
||||
/// What sort of machine inventory does this restock?
|
||||
/// This is checked against the VendingMachineComponent's pack value.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("canRestock", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<VendingMachineInventoryPrototype>))]
|
||||
public HashSet<string> CanRestock = new();
|
||||
[DataField(customTypeSerializer: typeof(PrototypeIdHashSetSerializer<VendingMachineInventoryPrototype>))]
|
||||
public HashSet<string> CanRestock = [];
|
||||
|
||||
/// <summary>
|
||||
/// Sound that plays when starting to restock a machine.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("soundRestockStart")]
|
||||
[DataField]
|
||||
public SoundSpecifier SoundRestockStart = new SoundPathSpecifier("/Audio/Machines/vending_restock_start.ogg")
|
||||
{
|
||||
Params = new AudioParams
|
||||
@@ -41,12 +38,10 @@ public sealed partial class VendingMachineRestockComponent : Component
|
||||
/// <summary>
|
||||
/// Sound that plays when finished restocking a machine.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("soundRestockDone")]
|
||||
public SoundSpecifier SoundRestockDone = new SoundPathSpecifier("/Audio/Machines/vending_restock_done.ogg");
|
||||
[DataField]
|
||||
public SoundSpecifier SoundRestockDone = new SoundPathSpecifier("/Audio/Machines/vending_restock_done.ogg",
|
||||
AudioParams.Default.WithVolume(-2f).WithVariation(0.2f));
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class RestockDoAfterEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
public sealed partial class RestockDoAfterEvent : SimpleDoAfterEvent;
|
||||
|
||||
Reference in New Issue
Block a user