Fix vending machines throwing (#1225)
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
41
Content.IntegrationTests/Tests/VendingMachineTest.cs
Normal file
41
Content.IntegrationTests/Tests/VendingMachineTest.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using Content.Shared.VendingMachines;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.IntegrationTests.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
[TestOf(typeof(VendingMachineInventoryPrototype))]
|
||||||
|
public sealed class VendingMachineTest : ContentIntegrationTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public async Task Test()
|
||||||
|
{
|
||||||
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
|
server.Assert(() =>
|
||||||
|
{
|
||||||
|
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||||
|
foreach (var vendorProto in prototypeManager.EnumeratePrototypes<VendingMachineInventoryPrototype>())
|
||||||
|
{
|
||||||
|
foreach (var (item, _) in vendorProto.StartingInventory)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
prototypeManager.Index<EntityPrototype>(item);
|
||||||
|
}
|
||||||
|
catch (UnknownPrototypeException)
|
||||||
|
{
|
||||||
|
throw new UnknownPrototypeException($"Unknown prototype {item} on vending inventory {vendorProto.Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await server.WaitIdleAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,53 +4,31 @@
|
|||||||
description: A generic ammunition vending machine.
|
description: A generic ammunition vending machine.
|
||||||
spriteName: ammo
|
spriteName: ammo
|
||||||
startingInventory:
|
startingInventory:
|
||||||
box_32: 3
|
BoxClRifleBox: 3
|
||||||
box_32f: 3
|
BoxClRifleBoxFlash: 3
|
||||||
box_32hv: 3
|
BoxClRifleBoxHV: 3
|
||||||
box_32p: 3
|
BoxClRifleBoxPractice: 3
|
||||||
box_32r: 3
|
BoxClRifleBoxRubber: 3
|
||||||
|
|
||||||
box_357: 3
|
BoxLRifleBigBox: 3
|
||||||
box_357f: 3
|
BoxLRifleBoxHV: 3
|
||||||
box_357hv: 3
|
BoxLRifleBoxPractice: 3
|
||||||
box_357p: 3
|
BoxLRifleBoxRubber: 3
|
||||||
box_357r: 3
|
|
||||||
|
|
||||||
box_44: 3
|
BoxMagnum: 3
|
||||||
box_44f: 3
|
BoxMagnumFlash: 3
|
||||||
box_44hv: 3
|
BoxMagnumHV: 3
|
||||||
box_44p: 3
|
BoxMagnumPractice: 3
|
||||||
box_44r: 3
|
BoxMagnumRubber: 3
|
||||||
|
|
||||||
box_45: 3
|
BoxPistolBox: 3
|
||||||
box_45f: 3
|
BoxPistolBoxFlash: 3
|
||||||
box_45p: 3
|
BoxPistolBoxHV: 3
|
||||||
box_45r: 3
|
BoxPistolBoxPractice: 3
|
||||||
|
BoxPistolBoxRubber: 3
|
||||||
box_50: 3
|
|
||||||
box_50f: 3
|
|
||||||
box_50p: 3
|
|
||||||
box_50r: 3
|
|
||||||
|
|
||||||
box_10mm: 3
|
|
||||||
box_10mmf: 3
|
|
||||||
box_10mmhv: 3
|
|
||||||
box_10mmp: 3
|
|
||||||
box_10mmr: 3
|
|
||||||
|
|
||||||
box_24mm: 3
|
|
||||||
|
|
||||||
box_556mm: 3
|
|
||||||
box_556mmp: 3
|
|
||||||
|
|
||||||
box_65mm: 3
|
|
||||||
box_65mmr: 3
|
|
||||||
|
|
||||||
box_762mm: 3
|
|
||||||
|
|
||||||
box_9mm: 3
|
|
||||||
box_9mmf: 3
|
|
||||||
box_9mmhv: 3
|
|
||||||
box_9mmp: 3
|
|
||||||
box_9mmr: 3
|
|
||||||
|
|
||||||
|
BoxSRifleBox: 3
|
||||||
|
BoxSRifleBoxFlash: 3
|
||||||
|
BoxSRifleBoxHV: 3
|
||||||
|
BoxSRifleBoxPractice: 3
|
||||||
|
BoxSRifleBoxRubber: 3
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
DrinkColaCan: 10
|
DrinkColaCan: 10
|
||||||
DrinkIceTeaCan: 10
|
DrinkIceTeaCan: 10
|
||||||
DrinkLemonLimeCan: 10
|
DrinkLemonLimeCan: 10
|
||||||
DrinkPurpleCan: 10
|
DrinkGrapeCan: 10
|
||||||
DrinkSpaceMountainWindCan: 10
|
DrinkSpaceMountainWindCan: 10
|
||||||
DrinkSpaceUpCan: 10
|
DrinkSpaceUpCan: 10
|
||||||
DrinkStarkistCan: 10
|
DrinkStarkistCan: 10
|
||||||
|
|||||||
Reference in New Issue
Block a user