Revert "SS14-12462 Nerf food and drink vending machines (#25999)"
This reverts commit 41093ab03c.
# Conflicts:
# Content.Shared/VendingMachines/SharedVendingMachineSystem.cs
# Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml
This commit is contained in:
@@ -6,7 +6,6 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Random;
|
|
||||||
|
|
||||||
namespace Content.Shared.VendingMachines;
|
namespace Content.Shared.VendingMachines;
|
||||||
|
|
||||||
@@ -17,7 +16,6 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
|
|||||||
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
||||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||||
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
[Dependency] protected readonly SharedPopupSystem Popup = default!;
|
||||||
[Dependency] protected readonly IRobustRandom Randomizer = default!;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -28,13 +26,10 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
|
|||||||
|
|
||||||
protected virtual void OnComponentInit(EntityUid uid, VendingMachineComponent component, ComponentInit args)
|
protected virtual void OnComponentInit(EntityUid uid, VendingMachineComponent component, ComponentInit args)
|
||||||
{
|
{
|
||||||
RestockInventoryFromPrototype(uid, component, component.InitialStockQuality);
|
RestockInventoryFromPrototype(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestockInventoryFromPrototype(
|
public void RestockInventoryFromPrototype(EntityUid uid, VendingMachineComponent? component = null)
|
||||||
EntityUid uid,
|
|
||||||
VendingMachineComponent? component = null,
|
|
||||||
float restockQuality = 1f)
|
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
{
|
{
|
||||||
@@ -44,9 +39,9 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
|
|||||||
if (!PrototypeManager.TryIndex(component.PackPrototypeId, out VendingMachineInventoryPrototype? packPrototype))
|
if (!PrototypeManager.TryIndex(component.PackPrototypeId, out VendingMachineInventoryPrototype? packPrototype))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AddInventoryFromPrototype(uid, packPrototype.StartingInventory, InventoryType.Regular, component, restockQuality);
|
AddInventoryFromPrototype(uid, packPrototype.StartingInventory, InventoryType.Regular, component);
|
||||||
AddInventoryFromPrototype(uid, packPrototype.EmaggedInventory, InventoryType.Emagged, component, restockQuality);
|
AddInventoryFromPrototype(uid, packPrototype.EmaggedInventory, InventoryType.Emagged, component);
|
||||||
AddInventoryFromPrototype(uid, packPrototype.ContrabandInventory, InventoryType.Contraband, component, restockQuality);
|
AddInventoryFromPrototype(uid, packPrototype.ContrabandInventory, InventoryType.Contraband, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -76,7 +71,7 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
|
|||||||
public List<VendingMachineInventoryEntry> GetAvailableInventory(EntityUid uid, VendingMachineComponent? component = null)
|
public List<VendingMachineInventoryEntry> GetAvailableInventory(EntityUid uid, VendingMachineComponent? component = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return [];
|
return new();
|
||||||
|
|
||||||
return GetAllInventory(uid, component).Where(inventoryEntry => inventoryEntry.Amount > 0).ToList();
|
return GetAllInventory(uid, component).Where(inventoryEntry => inventoryEntry.Amount > 0).ToList();
|
||||||
}
|
}
|
||||||
@@ -85,8 +80,7 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
|
|||||||
EntityUid uid,
|
EntityUid uid,
|
||||||
Dictionary<string, uint>? entries,
|
Dictionary<string, uint>? entries,
|
||||||
InventoryType type,
|
InventoryType type,
|
||||||
VendingMachineComponent? component = null,
|
VendingMachineComponent? component = null)
|
||||||
float restockQuality = 1.0f)
|
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component) || entries == null)
|
if (!Resolve(uid, ref component) || entries == null)
|
||||||
{
|
{
|
||||||
@@ -113,15 +107,6 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
if (PrototypeManager.TryIndex<EntityPrototype>(id, out var proto)) // WD EDIT
|
if (PrototypeManager.TryIndex<EntityPrototype>(id, out var proto)) // WD EDIT
|
||||||
{
|
{
|
||||||
var restock = amount;
|
|
||||||
var chanceOfMissingStock = 1 - restockQuality;
|
|
||||||
|
|
||||||
var result = Randomizer.NextFloat(0, 1);
|
|
||||||
if (result < chanceOfMissingStock)
|
|
||||||
{
|
|
||||||
restock = (uint) Math.Floor(amount * result / chanceOfMissingStock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inventory.TryGetValue(id, out var entry))
|
if (inventory.TryGetValue(id, out var entry))
|
||||||
// Prevent a machine's stock from going over three times
|
// Prevent a machine's stock from going over three times
|
||||||
// the prototype's normal amount. This is an arbitrary
|
// the prototype's normal amount. This is an arbitrary
|
||||||
@@ -129,11 +114,11 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
|
|||||||
// restocking a machine who doesn't want to force vend out
|
// restocking a machine who doesn't want to force vend out
|
||||||
// all the items just to restock one empty slot without
|
// all the items just to restock one empty slot without
|
||||||
// losing the rest of the restock.
|
// losing the rest of the restock.
|
||||||
entry.Amount = Math.Min(entry.Amount + amount, 3 * restock);
|
entry.Amount = Math.Min(entry.Amount + amount, 3 * amount);
|
||||||
else // WD EDIT START
|
else // WD EDIT START
|
||||||
{
|
{
|
||||||
var price = GetEntryPrice(proto);
|
var price = GetEntryPrice(proto);
|
||||||
inventory.Add(id, new VendingMachineInventoryEntry(type, id, restock, price));
|
inventory.Add(id, new VendingMachineInventoryEntry(type, id, amount, price));
|
||||||
} // WD EDIT END
|
} // WD EDIT END
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,14 +123,6 @@ namespace Content.Shared.VendingMachines
|
|||||||
public float DenyAccumulator = 0f;
|
public float DenyAccumulator = 0f;
|
||||||
public float DispenseOnHitAccumulator = 0f;
|
public float DispenseOnHitAccumulator = 0f;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The quality of the stock in the vending machine on spawn.
|
|
||||||
/// Represents the percentage chance (0.0f = 0%, 1.0f = 100%) each set of items in the machine is fully-stocked.
|
|
||||||
/// If not fully stocked, the stock will have a random value between 0 (inclusive) and max stock (exclusive).
|
|
||||||
/// </summary>
|
|
||||||
[DataField]
|
|
||||||
public float InitialStockQuality = 1.0f;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// While disabled by EMP it randomly ejects items
|
/// While disabled by EMP it randomly ejects items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -384,7 +384,6 @@
|
|||||||
ejectDelay: 5
|
ejectDelay: 5
|
||||||
soundVend: /Audio/Machines/machine_vend_hot_drink.ogg
|
soundVend: /Audio/Machines/machine_vend_hot_drink.ogg
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
initialStockQuality: 0.33
|
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: HotDrinksMachineAds
|
pack: HotDrinksMachineAds
|
||||||
- type: SpeakOnUIClosed
|
- type: SpeakOnUIClosed
|
||||||
@@ -425,7 +424,6 @@
|
|||||||
denyState: deny-unshaded
|
denyState: deny-unshaded
|
||||||
ejectDelay: 1.9
|
ejectDelay: 1.9
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
initialStockQuality: 0.33
|
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: RobustSoftdrinksAds
|
pack: RobustSoftdrinksAds
|
||||||
- type: SpeakOnUIClosed
|
- type: SpeakOnUIClosed
|
||||||
@@ -575,7 +573,6 @@
|
|||||||
denyState: deny-unshaded
|
denyState: deny-unshaded
|
||||||
ejectDelay: 1.9
|
ejectDelay: 1.9
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
initialStockQuality: 0.33
|
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: RobustSoftdrinksAds
|
pack: RobustSoftdrinksAds
|
||||||
- type: Speech
|
- type: Speech
|
||||||
@@ -611,7 +608,6 @@
|
|||||||
denyState: deny-unshaded
|
denyState: deny-unshaded
|
||||||
ejectDelay: 1.9
|
ejectDelay: 1.9
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
initialStockQuality: 0.33
|
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: RobustSoftdrinksAds
|
pack: RobustSoftdrinksAds
|
||||||
- type: SpeakOnUIClosed
|
- type: SpeakOnUIClosed
|
||||||
@@ -648,7 +644,6 @@
|
|||||||
ejectState: eject-unshaded
|
ejectState: eject-unshaded
|
||||||
denyState: deny-unshaded
|
denyState: deny-unshaded
|
||||||
ejectDelay: 1.9
|
ejectDelay: 1.9
|
||||||
initialStockQuality: 0.33
|
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: RobustSoftdrinksAds
|
pack: RobustSoftdrinksAds
|
||||||
- type: SpeakOnUIClosed
|
- type: SpeakOnUIClosed
|
||||||
@@ -745,7 +740,6 @@
|
|||||||
offState: off
|
offState: off
|
||||||
brokenState: broken
|
brokenState: broken
|
||||||
normalState: normal-unshaded
|
normalState: normal-unshaded
|
||||||
initialStockQuality: 0.33
|
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: DiscountDansAds
|
pack: DiscountDansAds
|
||||||
@@ -962,7 +956,6 @@
|
|||||||
normalState: normal-unshaded
|
normalState: normal-unshaded
|
||||||
ejectState: eject-unshaded
|
ejectState: eject-unshaded
|
||||||
denyState: deny-unshaded
|
denyState: deny-unshaded
|
||||||
initialStockQuality: 0.33
|
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: GetmoreChocolateCorpAds
|
pack: GetmoreChocolateCorpAds
|
||||||
@@ -1111,7 +1104,6 @@
|
|||||||
ejectState: eject-unshaded
|
ejectState: eject-unshaded
|
||||||
denyState: deny-unshaded
|
denyState: deny-unshaded
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
initialStockQuality: 0.33
|
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: BodaAds
|
pack: BodaAds
|
||||||
- type: SpeakOnUIClosed
|
- type: SpeakOnUIClosed
|
||||||
@@ -1320,7 +1312,6 @@
|
|||||||
offState: off
|
offState: off
|
||||||
brokenState: broken
|
brokenState: broken
|
||||||
normalState: normal-unshaded
|
normalState: normal-unshaded
|
||||||
initialStockQuality: 0.33
|
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: ChangAds
|
pack: ChangAds
|
||||||
@@ -1387,7 +1378,6 @@
|
|||||||
offState: off
|
offState: off
|
||||||
brokenState: broken
|
brokenState: broken
|
||||||
normalState: normal-unshaded
|
normalState: normal-unshaded
|
||||||
initialStockQuality: 0.33
|
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: DonutAds
|
pack: DonutAds
|
||||||
@@ -2058,7 +2048,6 @@
|
|||||||
ejectDelay: 1.9
|
ejectDelay: 1.9
|
||||||
soundVend: /Audio/Items/bikehorn.ogg
|
soundVend: /Audio/Items/bikehorn.ogg
|
||||||
priceMultiplier: 1.0
|
priceMultiplier: 1.0
|
||||||
initialStockQuality: 1.0 # Nobody knows how Honk does it, but their vending machines always seem well-stocked...
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Machines/VendingMachines/happyhonk.rsi
|
sprite: Structures/Machines/VendingMachines/happyhonk.rsi
|
||||||
layers:
|
layers:
|
||||||
|
|||||||
Reference in New Issue
Block a user