Fix vending machines throwing (#1225)

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-07-03 00:03:57 +10:00
committed by GitHub
parent 9f1bdb4b0a
commit c3c78258e7
3 changed files with 66 additions and 47 deletions

View 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();
}
}
}

View File

@@ -4,53 +4,31 @@
description: A generic ammunition vending machine.
spriteName: ammo
startingInventory:
box_32: 3
box_32f: 3
box_32hv: 3
box_32p: 3
box_32r: 3
BoxClRifleBox: 3
BoxClRifleBoxFlash: 3
BoxClRifleBoxHV: 3
BoxClRifleBoxPractice: 3
BoxClRifleBoxRubber: 3
box_357: 3
box_357f: 3
box_357hv: 3
box_357p: 3
box_357r: 3
BoxLRifleBigBox: 3
BoxLRifleBoxHV: 3
BoxLRifleBoxPractice: 3
BoxLRifleBoxRubber: 3
box_44: 3
box_44f: 3
box_44hv: 3
box_44p: 3
box_44r: 3
BoxMagnum: 3
BoxMagnumFlash: 3
BoxMagnumHV: 3
BoxMagnumPractice: 3
BoxMagnumRubber: 3
box_45: 3
box_45f: 3
box_45p: 3
box_45r: 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
BoxPistolBox: 3
BoxPistolBoxFlash: 3
BoxPistolBoxHV: 3
BoxPistolBoxPractice: 3
BoxPistolBoxRubber: 3
BoxSRifleBox: 3
BoxSRifleBoxFlash: 3
BoxSRifleBoxHV: 3
BoxSRifleBoxPractice: 3
BoxSRifleBoxRubber: 3

View File

@@ -8,7 +8,7 @@
DrinkColaCan: 10
DrinkIceTeaCan: 10
DrinkLemonLimeCan: 10
DrinkPurpleCan: 10
DrinkGrapeCan: 10
DrinkSpaceMountainWindCan: 10
DrinkSpaceUpCan: 10
DrinkStarkistCan: 10